-
Notifications
You must be signed in to change notification settings - Fork 910
S3 PutObject with ChecksumAlgorithm Sets Empty Content-Encoding Header #3569
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
Comments
I see the same behavior, version 2.18.22, jdk 11.0.17 In addition, when trying to set the Content-Encoding while using checksumAlgorithm(), the system metadata will have a blank value instead of the value I try to set.
results in a blank Content-Encoding in the system metadata instead of the value of "gzip". Leaving out the builder.checksumAlgorithm() line results in the value being set correctly. |
@iheffernan @awanrky thank you for reaching out. I'm able to repro. We'll investigate. |
When Trailing checksum is sent , we need to update the Content-encoding as aws-chunked.
However, this is not shown in the AWS UI Console. I observed the same behaviour with CLI command too
|
I'm seeing something somewhat similar, but using the S3TransferManager (with S3AsyncClient using CRT). When I upload some data the content encoding isn't getting set. The code byte[] compressedResultBytes = byteArrayOutputStream.toByteArray();
String md5Base64 = BASE64_ENCODER.encodeToString(DigestUtils.md5(compressedResultBytes));
PutObjectRequest putObjectRequest = PutObjectRequest.builder()
.bucket(cacheS3Bucket)
.key(cacheObjectKey)
.contentType(resultContentType)
.contentEncoding(CONTENT_ENCODING)
.contentLength((long) compressedResultBytes.length)
.contentMD5(md5Base64)
.serverSideEncryption(ServerSideEncryption.AES256)
.build();
AsyncRequestBody asyncRequestBody = AsyncRequestBody.fromBytes(compressedResultBytes);
UploadRequest uploadRequest = UploadRequest.builder()
.putObjectRequest(putObjectRequest)
.requestBody(asyncRequestBody)
.build();
Upload upload = s3TransferManager.upload(uploadRequest); In this case the As a workaround, disabling checksum validation in the Then, I tried adding a SHA256 checksum (with or without setting the
I'm using version 2.19.4 of the SDK on Java 11, GraalVM version 22.3.0, ARM64 running in an Ubuntu 22.10 container on Mac OS 12.6. |
A quick update: we are still checking with the S3 team what's the expected behavior of using chunked encoding with additional |
I'm experiencing the same issue using
@joviegas is this an expected and compulsory behavior? My use case is that I'm passing the ChecksumAlgorithm argument when uploading a gzipped file so that S3 calculates and stores the checksum in the head object, as explained by this docs. Later in my workflow, I sometimes need to retrieve that checksum to compare it with the checksum of some local files. Still, I would want to be able to set and mantain the ContentEncoding to gzip. |
Thanks for mentioning the use case , I need to check this with S3 , I am follow up with the team again. |
…ten to aws-chunked with Checksum algorithm enabled
…ten to aws-chunked with Checksum algorithm enabled
@giacomorebecchi Thanks for follow up |
…ten to aws-chunked with Checksum algorithm enabled (#3720)
A fix was released in version 2.19.25. I tested both vanilla S3Client and S3TransferManager, and the content encoding seems to be reflected in the S3 object metadata now. Let us know if you have any questions. |
|
Describe the bug
When performing an S3 PutObject operation with the
ChecksumAlgorithm
property set, an emptyContent-Encoding
header is set on the object in S3.NOTE: If I manually compute and specify the checksum, the
Content-Encoding
header does NOT get set.Expected Behavior
Content-Encoding
header should remain unset when usingChecksumAlgorithm
.Current Behavior
No errors present. Only noticed because it was causing issues downstream when retrieving objects through the CloudFront.
Reproduction Steps
results in empty
Content-Encoding
System defined metadata when viewing in S3 console.results in no
Content-Encoding
System defined metadata in S3 console.Possible Solution
No response
Additional Information/Context
No response
AWS Java SDK version used
2.18.20
JDK version used
17.0.3
Operating System and version
MacOS Ventura 13.0.1
The text was updated successfully, but these errors were encountered: