Hei!AWS Credenziali mancanti quando provo a inviare qualcosa al mio S3 Bucket (Node.js)
Ho riscontrato questo problema da ieri e ho problemi a trovare una soluzione.
sto cercando di inviare quarantina al mio secchio S3, ma questo messaggio appare nella mia console quando provo:
{ [CredentialsError: Missing credentials in config]
message: 'Missing credentials in config',
code: 'CredentialsError',
errno: 'Unknown system errno 64',
syscall: 'connect',
time: Thu Oct 09 2014 14:03:56 GMT-0300 (BRT),
originalError:
{ message: 'Could not load credentials from any providers',
code: 'CredentialsError',
errno: 'Unknown system errno 64',
syscall: 'connect',
time: Thu Oct 09 2014 14:03:56 GMT-0300 (BRT),
originalError:
{ code: 'Unknown system errno 64',
errno: 'Unknown system errno 64',
syscall: 'connect',
message: 'connect Unknown system errno 64' } } }
E questo è il mio codice:
var s3 = new AWS.S3();
AWS.config.loadFromPath('./AwsConfig.json');
s3.putObject(params, function(err) {
if(err) {
console.log(err);
}
else {
console.log("Succes");
}
});
Le credenziali sono corretta. Qualcuno sa cosa può essere? Ho cercato ma non trovo da nessuna parte la soluzione.
mie credenziali (finti):
{
"accessKeyId": "BLALBLALBLALLBLALB",
"secretAccessKey": "BLABLALBLALBLALBLLALBLALLBLALB",
"region": "sa-east-1",
"apiVersions": {
"s3": "2006-03-01",
"ses": "2010-12-01"
}
}
EDIT:
Per informazioni, tutto il codice:
var fs = require('fs');
var AWS = require('aws-sdk');
var s3 = new AWS.S3();
AWS.config.loadFromPath('./MYPATH.json'); //this is my path to the aws credentials.
var params = {
Bucket: 'testing-dev-2222',
Key: file,
Body: fs.createReadStream(file)
};
s3.putObject(params, function(err) {
if(err) {
console.log(err);
}
else {
console.log("Success");
}
});
Nuovo err:
Error uploading data: { [PermanentRedirect: The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.]
message: 'The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.',
code: 'PermanentRedirect',
time: Thu Oct 09 2014 14:50:02 GMT-0300 (BRT),
statusCode: 301,
retryable: false }
si può aggiungere il config.json file (nascondi le credenziali reali)? – xShirase
fatto! @xShirase –
Una cosa interessante, sto usando sns per mandarmi una mail quando le cose vengono inviate al mio bucket (il mio backup). Mi sta mandando lo stesso errore. Come può accedere agli sn se le credenziali sono sbagliate? –