sid 3835 no im using module helper for

@sdnts no im using module helper for S3 in elixir
config = %{
region: @s3_region,
access_key_id: System.fetch_env!("AWS_ACCESS_KEY_ID"),
secret_access_key: System.fetch_env!("AWS_SECRET_ACCESS_KEY")
}


{:ok, fields} = SimpleS3Upload.sign_form_upload(config, @s3_bucket,
key: filename(entry),
content_type: entry.client_type,
max_file_size: socket.assigns.uploads[entry.upload_config].max_file_size,
expires_in: :timer.hours(1)
)

metadata = %{
uploader: "S3",
key: filename(entry),
url: @s3_url,
fields: fields
}
config = %{
region: @s3_region,
access_key_id: System.fetch_env!("AWS_ACCESS_KEY_ID"),
secret_access_key: System.fetch_env!("AWS_SECRET_ACCESS_KEY")
}


{:ok, fields} = SimpleS3Upload.sign_form_upload(config, @s3_bucket,
key: filename(entry),
content_type: entry.client_type,
max_file_size: socket.assigns.uploads[entry.upload_config].max_file_size,
expires_in: :timer.hours(1)
)

metadata = %{
uploader: "S3",
key: filename(entry),
url: @s3_url,
fields: fields
}
i thought that it will work as well with the s3 compat api, it sends
xhr.open("POST", url, true)
xhr.send(formData)
xhr.open("POST", url, true)
xhr.send(formData)
request
4 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
noctate
noctateOP2y ago
but i think this module should handle that stuff, it does for s3, I believe? https://gist.github.com/chrismccord/37862f1f8b1f5148644b75d20d1cb073 this is the way to do it in liveview which is a weird hybrid of client and server in phoenix, how can I make sure that headers are set correctly?
Gist
Simple, dependency-free S3 Form Upload using HTTP POST sigv4
Simple, dependency-free S3 Form Upload using HTTP POST sigv4 - simple_s3_upload.ex
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
noctate
noctateOP2y ago
hmm but again i dont understand why with aws and the same code, same cors policies, I can see in the RESPONSE headers I can clearly see the 'Access-Control-Allow-Origin' header, but not with the r2 api turns out this module was not the right fit for the job, I have used ex_aws s3 library and it's working! Thanks, you help me get on the right track!
Want results from more Discord servers?
Add your server