Question
"Signature Does Not Match" when putting to presigned spaces upload url
I am using the aws-sdk in Node.js to generate a presigned putObject upload url for use with DigitalOcean Spaces. The url gets generated just fine, however when I try putting to it using a REST client, I get a SignatureDoesNotMatch error. Below is the code I am using to generate the presigned url (from within a Google Cloud Function):
var AWS = require('aws-sdk');
AWS.config.loadFromPath('./credentials.json');
var s3 = new AWS.S3({params: {Bucket: 'bucket-name'}});
exports.requestUploadUrl = function requestUploadUrl(req, res) {
var key = 'some-predefined-key';
s3.getSignedUrl('putObject', {Bucket: 'bucket-name', Key: key}, function (err, url) {
res.send(url);
});
}
I am getting this sort of response when I try posting to the presigned url:
<?xml version="1.0" encoding="UTF-8" ?>
<Error>
<Code>SignatureDoesNotMatch</Code>
<RequestId>tx000000000000000664ed3-0059eeef91-3777b-nyc3a</RequestId>
<HostId>3777b-nyc3a-nyc</HostId>
</Error>
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×
To clarify, I am using a multipart/form-data request in my REST client, and as far as I know I am doing everything correctly from the client side to test this.
For those interested, I am seeking help here for this issue as well, and some people have responded: https://github.com/aws/aws-sdk-js/issues/1776