Main issue:
I get a signature mismatch error (403 forbidden) when trying to hit the REST api for s3 using the versions
action (ListObjectVersions). It seems to me that this may be an error with how the auto-generated auth header is being generated, but I'm looking for clues on how to debug and/or fix this.
The exact error is:
<Code>SignatureDoesNotMatch</Code><Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message>
The odd thing about this is everything was working for the ListObjectsv2 (list-type=2
in the REST request). The only thing I changed in my url was to replace list-type=2
with versions
. I'm changing the action because I need to grab all versions of an object (file) instead of just all current objects.
I checked bucket policies and IAM permissions and verified the user's access locally, so that leads me to believe it's an issue with the auto-generated auth Header within Salesforce. The user has ListBucket
and ListBucketVersions
permissions.
Sample new url with the error:
https://mybucket.s3.amazonaws.com/?versions&prefix=myFolderPath
Sample old url that works:
https://mybucket.s3.amazonaws.com/?list-type=2&prefix=myFolderPath
where myFolderPath
is UTF-8 url encoded, and ends in a slash (before encoding).
The Apex classes that use the named credential are on api version 47, but are being migrated to 50 right now. It appears that the auto-generate feature was added in version 46.