I get a SignatureDoesNotMatch error when trying to put an object without specifying the content type. After turning on logging and looking at the raw Message prop in the response, I saw that S3 was expecting the client to sign "PUT\napplication/x-www-form-urlencoded\n...", but botocore was signing "PUT\n\n...". Once I specified any content type, the client was able to sign the string correctly put the object.
Using boto 0.0.5 w/ botocore 0.78.0.
@amattie could you turn on debug output? Try this:
import boto3
# Turn on high-level logging:
boto3.set_stream_logger(name='boto3')
# Turn on low-level and wire logging:
boto3.set_stream_logger(name='botocore')
# Do the requests
s3 = boto3.resource('s3')
s3.Bucket('foo').Object('bar').put(Body=b'test')
This should show some information about how the signature is being calculated and why you might be seeing the error response. Please remember to scrub any personal information before you paste the log output (your AWS secret key is never logged, but S3 bucket/object names and such might be important to hide).
@amattie were you able to gather any more information about this issue?
@amattie I have not gotten any responses in a few weeks and Boto 3 - 0.0.7 went out today which included a bunch of bug fixes, so I'm going to go ahead and close this issue. Please do reopen it if the issue is still a problem and you can give me more information to help debug the issue.
Sorry I was irresponsible in not responding to this. I'm running into issues trying to run this through 0.0.7 as reported in another issue, but it appears this problem does exist in at least 0.0.6 still. This is from the boto3 log output in that version:
2015-02-05 16:30:36,056 DEBUG:botocore.auth StringToSign:
PUT
XlMJyebV3YFc2xs3nf01cg==
Fri, 06 Feb 2015 00:30:36 GMT
/my-bucket/my-key
If / when I get 0.0.7 working, I'll report back again either way.
Most helpful comment
@amattie could you turn on debug output? Try this:
This should show some information about how the signature is being calculated and why you might be seeing the error response. Please remember to scrub any personal information before you paste the log output (your AWS secret key is never logged, but S3 bucket/object names and such might be important to hide).