-
Notifications
You must be signed in to change notification settings - Fork 594
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
Announcement: S3 default integrity change #6810
Comments
This breaks support for Cloudflare R2's S3 API, which returns |
Completely unusable with Cloudflare R2 since this release. How can this be disabled directly in js (without env vars or file settings)? |
The AWS SDK for JavaScript is designed to work with AWS services - in this case Amazon S3. As mentioned in the original post, we recommend not to disable default data integrity protections with Amazon S3.
|
When using the "@aws-sdk/lib-storage" I in the browser I always get the following error when uploading a large file. InvalidRequest: The upload was created using a crc32 checksum. The complete request must include the checksum for each part. It was missing for part 1 in the request. |
Hey @Mette1982 , It works on my end - import { Upload } from "@aws-sdk/lib-storage";
import { S3Client, ChecksumAlgorithm } from "@aws-sdk/client-s3";
import { readFile } from "fs/promises";
async function uploadLargeFile() {
try {
const fileContent = await readFile("./large-file.txt"); // file is 10MB
const parallelUploads3 = new Upload({
client: new S3Client({
region: "us-east-1",
}),
params: {
Bucket: "new-bucket-maggie-ma",
Key: "large-file.txt",
Body: fileContent,
// Ensure proper content type
ContentType: "text/plain",
ChecksumAlgorithm: ChecksumAlgorithm.CRC32,
},
// part size 5MB
partSize: 1024 * 1024 * 5,
queueSize: 1,
leavePartsOnError: true,
});
// Log upload progress
parallelUploads3.on("httpUploadProgress", (progress) => {
console.log(`Uploaded ${progress.loaded} of ${progress.total} bytes`);
});
await parallelUploads3.done();
console.log("File uploaded successfully");
} catch (error) {
console.error("Upload error:", error);
// Log more details about the error
if (error.message) console.error("Error message:", error.message);
if (error.code) console.error("Error code:", error.code);
}
}
uploadLargeFile(); Result I got -
Please check the version of the Thanks! |
@trivikr Right but this library doesn't live in a vacuum and is used extensively outside of AWS. This was poorly handled on your part and resulted in a ton of important major services breaking. This should have been released as a major breaking change, not a minor point release. It broke access to DigitalOcean Spaces (https://status.digitalocean.com/incidents/zbrpd3j7hrrd), Cloudflare R2 and Min.io just to name a few. |
#5479) * 🐛 fix: S3 client integrity check for Cloudflare R2 related issues: cloudflare/cloudflare-docs#19236 aws/aws-sdk-js-v3#6810 * Update index.ts --------- Co-authored-by: Arvin Xu <[email protected]>
This solution does not work for DELETE calls, which, for some reason, still include a checksum header even when both are "WHEN_REQUIRED" in the client configuration. How can I address this without sketchy header-cleaning middleware? |
This works indeed perfectly on a NodeJs environment but if I execute the same in a NextJs (executed in the browser) app for instance it no longer works. I created a small NextJs app to demonstrate my issue using the code sample you provided => https://github.com/Mette1982/aws-s3-error You only have to change values in the https://github.com/Mette1982/aws-s3-error/blob/main/src/app/upload.tsx file. |
@Mette1982 I can reproduce this issue using the next js app you provided. Created a separate bug report for this issue - #6818 |
In AWS SDK for JavaScript v3.729.0, we released changes to the S3 client that adopts new default integrity protections. For more information on default integrity behavior, please refer to the official SDK documentation. In SDK releases from this version on, clients default to enabling an additional checksum on all Put calls and enabling validation on Get calls.
You can disable default integrity protections for S3. We do not recommend this because checksums are important to S3 integrity posture. Integrity protections can be disabled by setting the config flag to
WHEN_REQUIRED
, or by using the related AWS shared config file settings or environment variables.Disclaimer: the AWS SDKs and CLI are designed for usage with official AWS services. We may introduce and enable new features by default, such as these new default integrity protections, prior to them being supported or otherwise handled by third-party service implementations. You can disable the new behavior with the
WHEN_REQUIRED
value for therequest_checksum_calculation
andresponse_checksum_validation
configuration options covered in Data Integrity Protections for Amazon S3.The text was updated successfully, but these errors were encountered: