-
Notifications
You must be signed in to change notification settings - Fork 633
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
I was working on the simple S3 upload feature using AWS SDK v3 (@aws-sdk/lib-storage).
- I started with the '@aws-sdk/[email protected]'
- Using
import { Upload } from '@aws-sdk/lib-storage'
I added trigger for a simple multipart upload.
new Upload({
client: s3Client,
params: {
Bucket: bucketName,
Key: uploadFile.objectKey,
Body: uploadFile.file,
ChecksumAlgorithm: ChecksumAlgorithm.SHA256, // I want to see SHA256 checksum in the s3, in the uploaded file details view
},
// Upload configuration options
partSize: MULTIPART_CHECKSUM_SIZE, // 8MB
queueSize: 1, // one multipart at a time
});
Unfortunately, using latest package version the upload never works end ends with error:
<Error>
<Code>
InvalidRequest
</Code>
<Message>
The upload was created using a sha256 checksum. The complete request must include the checksum for each part. It was missing for part 1 in the request.
</Message>
<RequestId>
6R9SCSQRBRGRCJZD
</RequestId>
<HostId>
V603PDxU2OHQU8pAaZCNpxRZ0EQCHmMJUBfvNZqfTytrlirIDF4ATG81vFDlabXoqsK4jea69xiQVCEdl8ftKFu++RXr+tfhP6s37oQbHBw=
</HostId>
</Error>
As long as the file is small enough to upload, it is working. If the file require more than one part I always see error:
So I reverted to @aws-sdk/[email protected]
and it's better now.
As long as the file is small enough to upload, it is working. But multiupload always fails with a missing checksum in the first part, even if it is included:
<Code>
InvalidRequest
</Code>
<Message>
The upload was created using a sha256 checksum. The complete request must include the checksum for each part. It was missing for part 1 in the request.
</Message>
<RequestId>
6R9SCSQRBRGRCJZD
</RequestId>
<HostId>
V603PDxU2OHQU8pAaZCNpxRZ0EQCHmMJUBfvNZqfTytrlirIDF4ATG81vFDlabXoqsK4jea69xiQVCEdl8ftKFu++RXr+tfhP6s37oQbHBw=
</HostId>
</Error>
Even if the checksum is included in the request:
x-amz-checksum-sha256
AC4CTL/a17JqbZWfNnGqbpDEwDEVm7dtQCEq08I32dM=
x-amz-content-sha256
002e024cbfdad7b26a6d959f3671aa6e90c4c031159bb76d40212ad3c237d9d3
x-amz-date
20251003T094243Z
x-amz-sdk-checksum-algorithm
SHA256
So the multipart upload with SHA256 checksum is not working either way.
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?
Browser
Details of the browser/Node.js/ReactNative version
v20.18.0
Reproduction Steps
- Install '@aws-sdk/lib-storage@latest'
- Import
import { Upload } from '@aws-sdk/lib-storage'
- Try to trigger multipart upload with SHA256 checksum
new Upload({
client: s3Client,
params: {
Bucket: bucketName,
Key: uploadFile.objectKey,
Body: uploadFile.file,
ChecksumAlgorithm: ChecksumAlgorithm.SHA256, // I want to see SHA256 checksum in the s3, in the uploaded file details view
},
// Upload configuration options
partSize: MULTIPART_CHECKSUM_SIZE, // 8MB
queueSize: 1, // one multipart at a time
});
Observed Behavior
Upload never works end ends with error:
<Error>
<Code>
InvalidRequest
</Code>
<Message>
The upload was created using a sha256 checksum. The complete request must include the checksum for each part. It was missing for part 1 in the request.
</Message>
<RequestId>
6R9SCSQRBRGRCJZD
</RequestId>
<HostId>
V603PDxU2OHQU8pAaZCNpxRZ0EQCHmMJUBfvNZqfTytrlirIDF4ATG81vFDlabXoqsK4jea69xiQVCEdl8ftKFu++RXr+tfhP6s37oQbHBw=
</HostId>
</Error>
As long as the file is small enough to upload, it is working. If the file require more than one part I always see error:
So I reverted to @aws-sdk/[email protected]
and it's better now.
As long as the file is small enough to upload, it is working. But multiupload always fails with a missing checksum in the first part, even if it is included:
<Code>
InvalidRequest
</Code>
<Message>
The upload was created using a sha256 checksum. The complete request must include the checksum for each part. It was missing for part 1 in the request.
</Message>
<RequestId>
6R9SCSQRBRGRCJZD
</RequestId>
<HostId>
V603PDxU2OHQU8pAaZCNpxRZ0EQCHmMJUBfvNZqfTytrlirIDF4ATG81vFDlabXoqsK4jea69xiQVCEdl8ftKFu++RXr+tfhP6s37oQbHBw=
</HostId>
</Error>
Even if the checksum is included in the request:
x-amz-checksum-sha256
AC4CTL/a17JqbZWfNnGqbpDEwDEVm7dtQCEq08I32dM=
x-amz-content-sha256
002e024cbfdad7b26a6d959f3671aa6e90c4c031159bb76d40212ad3c237d9d3
x-amz-date
20251003T094243Z
x-amz-sdk-checksum-algorithm
SHA256
So the multipart upload with SHA256 checksum is not working either way.
Expected Behavior
Successfully complete multipart upload with SHA256 integrity check using { Upload } from '@aws-sdk/lib-storage
Possible Solution
No response
Additional Information/Context
No response