I am getting a presigned url from aws and using it to request(PUT) a zip file. I get signature does not match.
when getting presigned url:
const params = {
Bucket: myBucket,
Key: myKey,
Expires: 60*60,
ACL: '**-**-**',
ContentType: 'application/x-zip-compressed'};
when requesting:
const formData = new FormData();
formData.append('file', file);
formData.append('filename', file.name);
fetch(url, {
method: 'PUT',
headers: {
'Content-Type': 'application/x-zip-compressed',
},
body: formData
})
Whatever
ACL
value you're using in the signature needs to also be sent in the request headers, as'x-amz-acl': '**-**-**'
.Note also that an S3
PUT
does not expectFormData
-- it expects thebody
to contain only the raw bytes of the object. This isn't the cause of the error, but once you correct the signature error, you'll need to change this, too, in order to get a valid, usable upload.