aws / aws-sdk-js-v3

Modularized AWS SDK for JavaScript.
Apache License 2.0
2.96k stars 557 forks source link

fix(lib-storage): call AbortMultipartUpload when failing to CompleteMultipartUpload #6112

Closed kuhe closed 1 month ago

kuhe commented 1 month ago

Issue

related to https://github.com/aws/aws-sdk-js-v3/pull/4414

Description

This PR modifies the behavior of @aws-sdk/lib-storage's Upload class' leavePartsOnError: boolean to do what it sounds like it does instead of something meaningless.

Previous to this PR:

As of this PR:

Testing

new e2e test

Additional context

Portion of docs from AWS SDK JSv2:

 * ## Handling Multipart Cleanup
 *
 * By default, this class will automatically clean up any multipart uploads
 * when an individual part upload fails. This behavior can be disabled in order
 * to manually handle failures by setting the `leavePartsOnError` configuration
 * option to `true` when initializing the upload object.

behavior (JSv2 source code):

    if (self.service.config.params.UploadId && !self.leavePartsOnError) {
      self.service.abortMultipartUpload().send();
    } else if (self.leavePartsOnError) {
      self.isDoneChunking = false;
    }

This behavior appears to have been lost in https://github.com/aws/aws-sdk-js-v3/pull/2039

Checklist

github-actions[bot] commented 3 weeks ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.