Start a Conversation

This post is more than 5 years old

Solved!

Go to Solution

1426

April 23rd, 2015 07:00

setting ACL on object does not work

I'm currently writing an application and I'm successfully able to upload objects into my bucket. However, I'm unsuccessfully able to set the ACL.

I'm using the AWS SDK for Node.js. Class: AWS.S3      — AWS SDK for JavaScript

When my code looks like this, the upload works without issue (but no permissions are set):

var params = {

  Bucket: 'emcphotobooth',

  Key: req.params.uniqueurl + '/' + req.body.number + '.jpeg',

  Body: buf,

  ContentType:  'image/jpeg',

  ContentEncoding: 'base64'

  };

s3.putObject(params, function(err, data) {

  if (err) console.log(err, err.stack); // an error occurred

  else     console.log(data);           // successful response

});

However, when I add in the ACL parameter I get an error. I need help on setting the file to be 'Public Read' during the upload process.

var params = {

  Bucket: 'emcphotobooth',

  Key: req.params.uniqueurl + '/' + req.body.number + '.jpeg',

  ACL: 'public-read',

  Body: buf,

  ContentType:  'image/jpeg',

  ContentEncoding: 'base64'

};

s3.putObject(params, function(err, data) {

  if (err) console.log(err, err.stack); // an error occurred

  else     console.log(data);           // successful response

});

error output:

{ [SignatureDoesNotMatch: The request signature we calculated does not match the signature you provided. Check your Secret Access Key and signing method. For more information, see REST Authentication and SOAP Authentication for details.]

  message: 'The request signature we calculated does not match the signature you provided. Check your Secret Access Key and signing method. For more information, see REST Authentication and SOAP Authentication for details.',

  code: 'SignatureDoesNotMatch',

  time: Thu Apr 23 2015 09:28:05 GMT-0400 (EDT),

  statusCode: 403,

  retryable: false,

  retryDelay: 30 } undefined

2 Posts

April 23rd, 2015 19:00

solved by Jason Cwik via a Load Balancer issue that was messing with the headers

No Events found!

Top