Configuring region in Node.js AWS SDK

前端 未结 14 1550
失恋的感觉
失恋的感觉 2020-12-05 03:30

Can someone explain how to fix a missing config error with Node.js? I\'ve followed all the examples from the aws doc page but I still get this error no matter what.

14条回答
  •  情话喂你
    2020-12-05 04:20

    This may not be the right way to do it, but I have all my configs in a separate JSON file. And this does fix the issue for me

    To load the AWS config, i do this:

    var awsConfig = config.aws;
    AWS.config.region = awsConfig.region;
    AWS.config.credentials = {
        accessKeyId: awsConfig.accessKeyId,
        secretAccessKey: awsConfig.secretAccessKey
    }
    

    config.aws is just a JSON file.

提交回复
热议问题