AWS Missing credentials when I try send something to my S3 Bucket (Node.js)
Try hardcoding your params and see if you get the error again :
AWS.config.update({
accessKeyId: "YOURKEY",
secretAccessKey: "YOURSECRET",
"region": "sa-east-1" <- If you want send something to your bucket, you need take off this settings, because the S3 are global.
}); // for simplicity. In prod, use loadConfigFromFile, or env variables
var s3 = new AWS.S3();
var params = {
Bucket: 'makersquest',
Key: 'mykey.txt',
Body: "HelloWorld"
};
s3.putObject(params, function (err, res) {
if (perr) {
console.log("Error uploading data: ", err);
} else {
console.log("Successfully uploaded data to myBucket/myKey");
}
});
Good resource here
I had the same problem until I reversed the two lines:
var s3 = new AWS.S3();
AWS.config.loadFromPath('./AwsConfig.json');
to this:
AWS.config.loadFromPath('./AwsConfig.json');
var s3 = new AWS.S3();