I'm trying to make an multipart upload using cloudfront as an endpoint, I know this is possible ( http://ift.tt/1Kxc6Y0 ), and I've also opened a ticket on the Github of aws-sdk-js, I don't know if I'm missing some configuration option, or something else, but I'm not able to do an upload trough Cloufront using the aws sdk multipart upload functions, I always get 503's on the PUT requests.
<Error>
<Code>SignatureDoesNotMatch</Code>
<Message>The request signature we calculated does not match the signature you provided. Check your key and signing method.</Message>
<AWSAccessKeyId>...</AWSAccessKeyId>
<StringToSign>POST
application/octet-stream; charset=UTF-8
x-amz-acl:private
x-amz-date:Tue, 28 Jul 2015 15:22:01 GMT
x-amz-user-agent:aws-sdk-js/2.1.40
/bucket-name/test_797965294</StringToSign>
<SignatureProvided>...</SignatureProvided>
<StringToSignBytes>....</StringToSignBytes><RequestId>7488F0A2F70E4AC5</RequestId>
<HostId>...</HostId>
</Error>
I'm using the following code start the multi-part upload:
AWS.config.update({
accessKeyId: 'XXXXXXXXXXXXXXXXX',
secretAccessKey: 'XXXXXXXXXXXXXXXXXX'
});
var s3Client = new AWS.S3({
endpoint: 'XXXXXXXX.cloudfront.net',
s3BucketEndpoint: true,
region: 'eu-west-1'
});
var TEMP_filename = 'test_' + Math.floor(1000000000*Math.random());
var params = {
Bucket: 'bucket-name',
Key: TEMP_filename,
ACL: 'private'
};
s3Client.createMultipartUpload(params, function(err, data) {
if (err) {
console.log(err, err.stack); // an error occurred
} else {
console.log(data); // successful response
}
});
Am I missing something in the configuration of the client?
It's also worth to mention, that when using, AWS.S3.ManagedUpload, almost everything works perfectly. If the file size is smaller than the required to make an multipart upload, everything goes ok, but when switching to an multipart upload everything breaks again. It's always on the POST requests, the PUT requests seem to work fine.
The only way this seems to work, is using the putObject
, function using this I don't have any problem whatsoever, but I need resume support, and that can only be achieved trough the multipart upload.
BTW, I'm using the latest version of the SDK: aws-sdk-js/2.1.40
Aucun commentaire:
Enregistrer un commentaire