I'm using knox (https://github.com/LearnBoost/knox) to upload a file to Amazon S3. I have just moved my node app to Amazon EC2 and have the following error when uploading with knox. I appear to have all of the libraries installed. The same code was OK on nodejitsu. I'm quite new to node / JS so I'm not sure what this means.
/home/ec2-user/foo/node_modules/knox/lib/auth.js:208
Object.keys(url.query).forEach(function (key) {
^
TypeError: Object.keys called on non-object
at Function.keys (native)
at Object.exports.canonicalizeResource (/home/ec2-user/foo/node_modules/knox/lib/auth.js:208:10)
at Client.request (/home/ec2-user/foo/node_modules/knox/lib/client.js:275:22)
at Client.put (/home/ec2-user/foo/node_modules/knox/lib/client.js:326:15)
at Client.putStream (/home/ec2-user/foo/node_modules/knox/lib/client.js:408:18)
at /home/ec2-user/foo/node_modules/knox/lib/client.js:378:20
at Object.oncomplete (fs.js:93:15)
Perhaps, you, like me, were passing the "mimetype" string as third parameter in client.putFile() function...
You must pass an object specifying the content type headers:
client.putFile(localPath, s3Path, {'Content-Type': mimetype} ,function(err, result) {});
or just ignore the third parameter (like I did):
client.putFile(localPath, s3Path, function(err, result) {});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With