Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

S3 multipart: network error causes uppy to get stuck in corrupt state #3972

Open
2 tasks done
Tokov opened this issue Aug 12, 2022 · 3 comments
Open
2 tasks done

S3 multipart: network error causes uppy to get stuck in corrupt state #3972

Tokov opened this issue Aug 12, 2022 · 3 comments
Assignees
Labels
AWS S3 Plugin that handles uploads to Amazon AWS S3 Bug

Comments

@Tokov
Copy link

Tokov commented Aug 12, 2022

Initial checklist

  • I understand this is a bug report and questions should be posted in the Community Forum
  • I searched issues and couldn’t find anything (or linked relevant results below)

Link to runnable example

No response

Steps to reproduce

Simple Test 1
Upload 1 file and force the POST call to the companion's complete endpoint to fail.

Simple test 2
Upload 1 file and corrupt one of the AWS upload URLs, for an individual part, in order to simulate a network error.

Advanced test:
In an angular app, upload two files with s3 multi. One large and one small.

Only for the small file, simulate a failure scenario in the "complete" companion endpoint and force an error, or corrupt one of the AWS URLs for an individual part.
Let the large file complete successfully.

Expected behavior

Simple test: Result object should be returned upon completion, and the failed file array should have a size of 1.

Advanced test:
After first file fails, the dashboard's progress should still update for the remaining files and the result object should be returned on completion.

Actual behavior

Uncaught promise errors in log.

Overall progress stops being tracked in dashboard and complete event does not fire. No result object is returned containing a success and failure array.

Also, because uppy did not cleanly terminate, it gets stuck in a corrupt state. Even though the file(s) will display as failed, and no network traffic is running in the browser , the following call will return True.

uppy.getObjectOfFilesPerState().isUploadInProgress()

For a simulated network error for the companion's complete method, this error is in the browser console:

Uncaught (in promise) Error: Could not post to xxx/s3/multipart/xxxx/complete?key=xxx
at Requestclient.js:203:13
at _ZoneDelegate.invoke (zone.js:372:26)

For an error uploading an individual AWS part, this error is in the browser console:

Error: Uncaught (in promise): Error: Non 2xx
at Multipart uploader.js:497:21

@Tokov Tokov changed the title S3 multipart w/ two files where small file fails on complete and large file keeps working S3 multipart failure: failed REST Post call to complete endpoint not handled Aug 12, 2022
@Tokov Tokov changed the title S3 multipart failure: failed REST Post call to complete endpoint not handled S3 multipart failure: failed REST POST call to companion's complete endpoint not handled Aug 12, 2022
@Tokov Tokov changed the title S3 multipart failure: failed REST POST call to companion's complete endpoint not handled S3 multipart failure: failed REST POST call to companion's complete endpoint not correctly handled Aug 12, 2022
@Tokov Tokov changed the title S3 multipart failure: failed REST POST call to companion's complete endpoint not correctly handled S3 multipart failure: failed POST call to companion's complete endpoint not correctly handled Aug 12, 2022
@Tokov Tokov changed the title S3 multipart failure: failed POST call to companion's complete endpoint not correctly handled S3 multipart: companiom POST failure is not handled Aug 18, 2022
@Tokov Tokov changed the title S3 multipart: companiom POST failure is not handled S3 multipart: companion POST failure is not handled Aug 18, 2022
@Tokov Tokov changed the title S3 multipart: companion POST failure is not handled S3 multipart: fatal errors prevent result and progress for remaining files Aug 18, 2022
@Tokov Tokov changed the title S3 multipart: fatal errors prevent result and progress for remaining files S3 multipart: fatal errors are not handled Aug 18, 2022
@Tokov Tokov changed the title S3 multipart: fatal errors are not handled S3 multipart: fatal errors are not always handled Aug 18, 2022
@Tokov Tokov changed the title S3 multipart: fatal errors are not always handled S3 multipart: network error causes uppy to get stuck in corrupt state Aug 18, 2022
@arturi arturi removed the Triage label Jul 6, 2023
@Murderlon Murderlon added the AWS S3 Plugin that handles uploads to Amazon AWS S3 label Feb 5, 2024
@jshow
Copy link

jshow commented May 1, 2024

does anyone have a work around for this ? reset uppy when network failures occur ?

@Murderlon
Copy link
Member

Do you have a reproducible example? Errors from the console? Anything?

@AAAstorga
Copy link

I had an issue with uppy and aws where I tried to terminate getUploadParameters randomly with an error to test my error handling. I realized there is a bug in the uppy aws multipart package. Sharing if people find it useful.

I am currently just patching the package, but this is the diff (this is in the @uppy/aws-s3-multipart package):

diff --git a/lib/index.js b/lib/index.js
index fa341973e2e8998a2d5b8f525b8f4703b2bdb028..cb60d2287014d1bd8394a2c1908632bd538f068c 100644
--- a/lib/index.js
    b/lib/index.js
@@ -179,7  179,7 @@ export default class AwsS3Multipart extends BasePlugin {
           }
           return _classPrivateFieldLooseBase(this, _uploadLocalFile)[_uploadLocalFile](file);
         });
-        const upload = await Promise.all(promises);
         const upload = await Promise.allSettled(promises);
         // After the upload is done, another upload may happen with only local files.
         // We reset the capability so that the next upload can use resumable uploads.
         _classPrivateFieldLooseBase(this, _setResumableUploadsCapability)[_setResumableUploadsCapability](true);

The code needs to be waiting for all promises to settle and not throwing early. This seems to fix all my issues. Hope it helps!

@Murderlon Murderlon assigned Murderlon and aduh95 and unassigned Murderlon May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AWS S3 Plugin that handles uploads to Amazon AWS S3 Bug
Projects
None yet
Development

No branches or pull requests

6 participants