-
Notifications
You must be signed in to change notification settings - Fork 634
Description
Checkboxes for prior research
- I've gone through Developer Guide and API reference
- I've checked AWS Forums and StackOverflow.
- I've searched for previous similar issues and didn't find any solution.
Describe the bug
This reopens #6115
I have encountered this issue using the Open Next CDK constructs. I have also found a potential work around for this issue in case it is useful to find a root cause.
The code that causes this issue is this code here: https://github.com/jetbridge/cdk-nextjs/blob/d5c116b0bffb14cc28928c32362946e9aef807b1/src/lambdas/nextjs-bucket-deployment.ts#L296
The solution to work around the bug is: https://github.com/radding/cdk-nextjs/blob/main/src/lambdas/nextjs-bucket-deployment.ts#L299C4-L311C36
As you can see in those two code samples, the work around is moving from uploading content in parallel to uploading content in serial. The await putObjectInputs.reduce(async (acc, params)
waits for the previous upload to complete before attempting to upload the next object.
Regression Issue
- Select this option if this issue appears to be a regression.
SDK version number
@aws-sdk/[email protected]
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
v20.11.0
Reproduction Steps
- Have a directory of files of various sizes, some images, some HTML, some Javascript
- Execute this code:
const fs = require('fs');
Promise.all(fs.readdirSync(testFolder).map(file => {
const upload = new Upload({.., params: { Key: file, Body: fs.readFileSync(file), Bucket: <target_bucket> })
return upload.done();
}));
Observed Behavior
Results in the following error and no upload: XAmzContentSHA256Mismatch: The provided 'x-amz-content-sha256' header does not match what was computed.
Expected Behavior
No error and upload is successful.
Possible Solution
My hypothesis is that there is something sharing memory between upload requests, as switch to serial uploads solves the problem. I suspect the problem is with in the multipart upload code, but I have not had the opportunity to dig in any deeper than this.
Additional Information/Context
This is basically just adding on to #6115