ECS-CommunityEdition
ECS-CommunityEdition copied to clipboard
DeleteObjects with recent AWS SDK returns error "Missing required header for this request: Content-MD5"
Summary
The recent AWS SDK have changes that prevent the use of the multiple delete objects API to be used with ECS. A "Missing required header for this request: Content-MD5" error is sent by the server.
Steps
// Install latest AWSSDK.S3 nuget package
IAmazonS3 s3Client = new AmazonS3Client();
List<KeyVersion> objectsToDelete =
new()
{
new KeyVersion { Key = "file1.txt" },
new KeyVersion { Key = "file2.jpg" }
};
DeleteObjectsRequest deleteObjectsRequest =
new()
{
BucketName = bucketName,
Objects = objectsToDelete
};
// The following calls will throw a "Missing required header for this request: Content-MD5" error.
DeleteObjectsResponse response = await s3Client.DeleteObjectsAsync(deleteObjectsRequest);
Notes
Below the headers sent to the server by the AWS SDK.
[0] {[Content-Type, application/xml]}
[1] {[amz-sdk-invocation-id, a06903e6-8b00-4333-bd4b-1918a0ae7408]}
[2] {[amz-sdk-request, attempt=1; max=3]}
[3] {[x-amz-checksum-crc32, FhWI9w==]}
[4] {[x-amz-sdk-checksum-algorithm, CRC32]}
[5] {[host, <REDACTED>]}
[6] {[X-Amz-Date, 20250625T211545Z]}
[7] {[X-Amz-Content-SHA256, bda51140d0b9e1dbabaef5dea2f23d1bd3a2da31ef1f3a24da04f2972a3dae57]}
[8] {[Authorization, AWS4-HMAC-SHA256 Credential=<REDACTED>, SignedHeaders=content-type;host;x-amz-checksum-crc32;x-amz-content-sha256;x-amz-date;x-amz-sdk-checksum-algorithm, Signature=<REDACTED>]}
[9] {[User-Agent, aws-sdk-dotnet-coreclr/4.0.3.0 ua/2.1 os/windows#10.0.26100.0 md/ARCH#X64 lang/.NET_Core#8.0.17 md/aws-sdk-dotnet-core#4.0.0.13 api/S3#4.0.3.0 md/ClientAsync cfg/init-coll#0 m/b,P,g,E,U,Z]}
[10] {[Content-Length, 142]}
References
See Minio issue (fixed): https://github.com/minio/minio/issues/20845 Related AWS .NET SDK issue (fixed): https://github.com/aws/aws-sdk-net/issues/3641 Related AWS Go SDK issue: https://github.com/aws/aws-sdk-go-v2/discussions/2960