-
Notifications
You must be signed in to change notification settings - Fork 634
Closed as not planned
Closed as not planned
Copy link
Labels
guidanceGeneral information and guidance, answers to FAQs, or recommended best practices/resources.General information and guidance, answers to FAQs, or recommended best practices/resources.
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
s3.deleteObjects sends CRC32 checksum even if requestChecksumCalculation
is set to WHEN_REQUIRED
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
All
Reproduction Steps
import { S3 } from "@aws-sdk/client-s3";
import { NodeHttpHandler } from "@smithy/node-http-handler";
class CustomHandler extends NodeHttpHandler {
constructor() {
super();
}
printChecksumHeaders(prefix, headers) {
for (const [header, value] of Object.entries(headers)) {
if (
header === "content-md5" ||
header.startsWith("x-amz-checksum-") ||
header.startsWith("x-amz-sdk-checksum-")
) {
console.log(`${prefix}['${header}']: '${value}'`);
}
}
}
async handle(request, options) {
this.printChecksumHeaders("request", request.headers);
const response = await super.handle(request, options);
this.printChecksumHeaders("response", response.response.headers);
return response;
}
}
const client = new S3({
requestHandler: new CustomHandler(),
requestChecksumCalculation: "WHEN_REQUIRED",
});
const Bucket = "test-flexible-checksums-v2"; // Update to your test bucket name.
const prepareClient = new S3();
// Populate an object in the bucket, as deleteObjects requires at least one.
await prepareClient.putObject({ Bucket, Key: "helloworld.txt", Body: "helloworld" });
// Get list of objects to delete.
const response = await prepareClient.listObjectsV2({ Bucket });
const Objects = response.Contents.map(({ Key }) => ({ Key }));
await client.deleteObjects({ Bucket, Delete: { Objects } });
Observed Behavior
The CRC32 checksum is sent even if requestChecksumCalculation
is set to WHEN_REQUIRED
$ node test.mjs
request['x-amz-sdk-checksum-algorithm']: 'CRC32'
request['x-amz-checksum-crc32']: 'uDrkBQ=='
Expected Behavior
When requestChecksumCalculation
is set to WHEN_REQUIRED
, should it send md5
like it was done in <=v3.729.0
?
Example output in v3.726.0
$ node test.mjs
request['content-md5']: 'rl/UEqX25ygZIHP8TWK6/g=='
Possible Solution
No response
Additional Information/Context
No response
Metadata
Metadata
Assignees
Labels
guidanceGeneral information and guidance, answers to FAQs, or recommended best practices/resources.General information and guidance, answers to FAQs, or recommended best practices/resources.