Skip to content
Advertisement

AWS S3 JavaScript SDK getSignedUrl returns base path only

I have some very simple code for generating an S3 URL. The URL I get back from the SDK only has the base path for S3. It doesn’t contain anything else. Why is this happening?

var AWS = require('aws-sdk');

var s3 = new AWS.S3();

console.log(s3.getSignedUrl('getObject', {
  Bucket: 'test',
  Key: 'test'
}));

// Returns "https://s3.amazonaws.com/"

Node.js v0.12.0, AWS SDK 2.1.15 or 2.1.17, Windows 7 64-bit,

Advertisement

Answer

The problem wasn’t with code. It turns out that when you don’t have your AWS credentials set up properly in your environment that the AWS SDK doesn’t complain. Fixing the credentials in ~/.aws/credentials resolved the issue.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement