我从昨天起就有这个问题,我很难找到解决办法。
我试图将一些东西发送到我的S3桶中,但是当我尝试时,这个消息会出现在我的控制台中:
{ [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' } } }这是我的密码:
var s3 = new AWS.S3();
AWS.config.loadFromPath('./AwsConfig.json'); 
    s3.putObject(params, function(err) {
        if(err) {
            console.log(err);
        }
        else {
            console.log("Succes");
        }
});证件是正确的。有人知道会是什么吗?我已经找过了,但我找不到解决办法。
我的证件(假的):
{
    "accessKeyId": "BLALBLALBLALLBLALB",
    "secretAccessKey": "BLABLALBLALBLALBLLALBLALLBLALB",
    "region": "sa-east-1",
    "apiVersions": {
      "s3": "2006-03-01",
      "ses": "2010-12-01"
    }
}编辑:
为寻求帮助,所有代码:
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");
    }
});新错误:
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 }发布于 2014-10-09 17:19:19
尝试对params进行硬编码,看看是否再次得到错误:
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");
    }
});这里的好资源
发布于 2015-10-16 16:36:02
我也有同样的问题,直到我把这两句话颠倒过来:
var s3 = new AWS.S3();
AWS.config.loadFromPath('./AwsConfig.json'); 对此:
AWS.config.loadFromPath('./AwsConfig.json'); 
var s3 = new AWS.S3();发布于 2016-08-29 00:23:39
我也犯了同样的错误。但我发现了问题。我使用了错误的环境变量名。从NodeJS到S3,我需要使用以下变量名:
process.env.AWS_ACCESS_KEY_ID = 'XXXXXXXXXXXXXXXXXXX';
process.env.AWS_SECRET_ACCESS_KEY = 'XXXXXXXXXXXXXXXXXXXXXXXXXX';
process.env.AWS_REGION = 'us-east-1';一旦我更正了变量名,它就会正常运行。你好,迪潘卡尔
https://stackoverflow.com/questions/26284181
复制相似问题