supabase/storage-js

File uploading occasionally fails

illright opened this issue · 2 comments

Bug report

Describe the bug

Sometimes, when I try to upload heavy files (50-100 MB), the website fails. Sometimes it shows errors (like below), sometimes it displays the progress level of 200% and 400% (like on the screenshot).

Failed to upload CaucasTalk_Episode111.mp3: Unexpected token < in JSON at position 0

According to the inspector, this error comes from the fact that POST requests to Supabase result in 502 Bad Gateway.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Go to your application in Supabase
  2. Click on "Storage"
  3. Try to upload several large files (first try uploading them one at a time, then try uploading them all together)
  4. See error

Expected behavior

All files should upload without trouble.

Screenshots

image

System information

  • OS: [e.g. macOS, Windows] Windows
  • Browser (if applies) [e.g. chrome, safari] Chrome (all extensions disabled)
  • Version of supabase-js: [e.g. 6.0.2]
  • Version of Node.js: [e.g. 10.10.0]

Additional context

This doesn't happen all the time, sometimes a few of the files manage to upload successfully. It happens frequently enough to be quite concerning. With this issue I'd like to shine some light on this problem, so sorry if this isn't very detailed. I'd be happy to follow up with exact scenarios and files that I upload, with exact conditions that I upload them in.

Okay, it turns out that the issue was in me hitting the upload limit (50 MB?). For some reason, the handling of these limit errors is not very predictable, sometimes it shows an unhelpful error, sometimes it tells you exactly what's wrong, sometimes it just breaks completely. I think it would be better to validate the size of the uploaded file on the client side to always show the correct error in a timely fashion

fenos commented

@illright thanks for opening the issue, I'm glad you found the root problem.

We'll double check the error messages returned by the server and make some improvements if necessary.

Closing for now