Phoenix LiveView Uploads with presigned urls

I am using presigned_url with PUT to upload to S3 via external url.

However a strange thing is happening.

  1. I can upload a .pdf / .mp4 / .bin format upto 15 Mb without any issue.
  2. any file close to 40MB has only 8MB size on S3 bucket even though the liveview’s handle_progress reports 100% upload.
  3. 50 MB file has roughly 17MB file size in S3.

the S3 backend is Cloudflare R2.
Edit: I can upload the files upto 2GB when using ExAws.put_object .

Due to this, when I try to download the same file via presigned url (GET), only 17MB is downloaded!

How to debug this issue?

2 Likes

so, one issue is preflight urls.

preflight_request - has the complete size = 39942663

preflight response - has chunk size = 1000000

and it appears to upload that first chunk only. (or maybe rewrites that over and over)

1 Like