-
Notifications
You must be signed in to change notification settings - Fork 962
Description
S3Client throws a S3Exception with message "The request signature we calculated does not match the signature you provided. Check your key and signing method. (Service: S3, Status Code: 403..."
Expected Behavior
The documentation says Amazon S3 allows arbitrary Unicode characters in your metadata values. https://docs.aws.amazon.com/AmazonS3/latest/userguide/UsingMetadata.html
Then it goes on that you should conform to using US-ASCII, the error message says nothing with that regard (and Status Code: 403)
I would expect that the SDK would transparently encode or unencode (e.g. Unicode escape), but having the setting that is mentioned on this aws/aws-sdk-net#1587 would also be nice. Even if you leave it up to the client code it would be great to have more to the point error message.
Current Behavior
When sending the request S3Exception with message "The request signature we calculated does not match the signature you provided. Check your key and signing method..." is thrown
Possible Solution
Adapt docs, e.g. in Java the PutObjectRequestBuilder.metadata doesn't say a word about only US-ASCII, and / or guard clause to protect against non-ASCII data
Ideally a setting as mentioned in aws/aws-sdk-net#1587, as I understand you cannot change the default behaviour
Steps to Reproduce (for bugs)
@Test
void createSimpleItemWithUmlaut() {
s3Client.putObject(PutObjectRequest.builder().bucket(TEST_BUCKET).key(System.currentTimeMillis() + "/" + "ä")
.metadata(Map.of( "some-key", "/ä"))
.build(), RequestBody.empty());
}
Context
Just trying to send also non-ASCII data
Your Environment
- AWS Java SDK version used: software.amazon.awssdk:s3:2.16.6
- JDK version used: openjdk 11.06
- Operating System and version: MacOS 11.5