node.jsamazon-s3downloadknox-amazon-s3-client

Node.js Amazon S3 - Download fails with SignatureDoesNotMatch error


Here's the code I'm using to download a file

var S3_KEY = 'xxxxxx';
var S3_SECRET = 'xxxxxx';
var S3_BUCKET = 'xxxxxx';
var s3Client = require('knox').createClient({
    "key": S3_KEY,
    "secret": S3_SECRET,
    "bucket": S3_BUCKET
});

// Pull some stuff down
s3Client.get('myFile.zip').on( 'response', function(res){
    console.log( "\n" + res.statusCode );
    console.log( "\n" + res.headers + "\n" );
    res.setEncoding( 'utf8' );
    res.on('data', function( chunk ) {
        console.log( chunk );
    });
}).end();

I'm getting a 403 error with a SignatureDoesNotMatch code. What am I doing wrong?


Solution

  • It seems like this is an issue on Knox's end. Apparently the problem has been solved, but the solution has not not pulled into the main project yet.

    See this thread: https://github.com/LearnBoost/knox/issues/56

    My workaround was to just remove the knox library and clone this repository into my node_modules folder: https://github.com/domenic/knox.git