Open YAOHAO9 opened 8 years ago
Try to specify region.
The error is encountered when trying to upload in Frankfurt region. The reason of can be found here :
Amazon S3 supports Signature Version 4, a protocol for authenticating inbound API requests to AWS services, in all AWS regions. At this time, AWS regions created before January 30, 2014 will continue to support the previous protocol, Signature Version 2. Any new regions after January 30, 2014 will support only Signature Version 4 and therefore all requests to those regions must be made with Signature Version 4. For more information about AWS Signature Version 2, see Signing and Authenticating REST Requests in the Amazon Simple Storage Service Developer Guide.
How can we achieve it here now, any help is much appreciated.
To fix this error pass the option signatureVersion: 'v4'
:
const s3 = require('s3');
const client = s3.createClient({
s3Options: {
accessKeyId: 'xxxx',
secretAccessKey: 'xxxxxxxx',
region: 'eu-central-1',
signatureVersion: 'v4',
},
});
unable to upload: InvalidRequest: The authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256.