transloadit / uppy

The next open source file uploader for web browsers :dog:
https://uppy.io
MIT License
28.99k stars 1.99k forks source link

upload complete event missing files after retry with aws-s3 multipart #4794

Open yellowtailfan opened 10 months ago

yellowtailfan commented 10 months ago

Initial checklist

Link to runnable example

No response

Steps to reproduce

  1. Uppy current release configured using aws-s3 with shouldUseMultipart set to true
  2. Using our own Lambas as endpoints for AwsS3
  3. Upload multiple large files
  4. One of the large file uploads fails with a 500 error from the fetch inside our createMultipartUpload() (I saw this in the wild, but for this test case I forced the server to randomly return a 500)
  5. I wait for the successful files to complete, no upload complete event is fired
  6. I press the retry button on the failed file in the Dashboard
  7. The retried uploads completes
  8. An upload complete event is emitted
  9. Our upload complete callback only receives the retried file (the initially successful files are not in the list)

If multiple files fail in the same way, then I get an upload complete event for each retried file that successfully completes.

Expected behavior

The upload complete event should include all files that have successfully completed, not just the ones that completed after retrying.

Actual behavior

See above.

juan-altatech commented 2 weeks ago

Yes, can confirm I saw this in the wild as well. If I find a workaround, I'll post it here

yellowtailfan commented 2 weeks ago

I worked around it by using the 'upload-success' event to record each successful file upload, then for the 'complete` event I use that recorded list of files and not the list supplied by the 'complete' event.

juan-altatech commented 2 weeks ago

thank you! I did that as well, however, I'm using react and evidently the state does not get updated quick enough for the complete event to have all of the files from the 'upload-success' event

yellowtailfan commented 2 weeks ago

We're using React as well, but we don't read the collected complete files from state until after the user clicks another button outside Uppy to confirm the job (and that button is disabled until the upload completes). So if there's a race condition like you might be seeing, then we wouldn't see it in our logic.