Creating S3 Signed URLs in node.js

I am using the knox module for https://github.com/LearnBoost/knox to create signed URLs for S3 files, which I already did with the PHP SDK before.

I can delete files from my bucket, but I get a SignatureDoesNotMatch error when trying to generate generated URLs for files with closed ACLs.

The code is as follows

var knox = require('knox'); var s3Client = knox.createClient({ key: '*****', secret: '*****', bucket: '*****' }); function getS3Url(filename) { var expires = new Date(); expires.setMinutes(expires.getMinutes() + 30); return s3Client.signedUrl(filename, expires); } console.log(getS3Url('file.txt')); 

What am I doing wrong?

+8
amazon-s3 knox-amazon-s3-client
source share
1 answer

It turns out that I lacked the leading '/' file name, now the signature signature.

0
source share

All Articles