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.
I had the same issue "Missing region in config" and in my case it was that, unlike in the CLI or Python SDK, the Node SDK won't read from the ~\.aws\config
file.
To solve this, you have three options:
Configure it programmatically (hard-coded): AWS.config.update({region:'your-region'});
Use an environment variable. While the CLI uses AWS_DEFAULT_REGION
, the Node SDK uses AWS_REGION
.
Load from a JSON file using AWS.config.loadFromPath('./config.json');
JSON format:
{
"accessKeyId": "akid",
"secretAccessKey": "secret",
"region": "us-east-1"
}