Open skytreader opened 5 years ago
Updating aws-sdk to latest version @2.497.0 solved this problem for me.
I don't have aws-sdk directly in my dependencies though:
"dependencies": {
"@hapi/joi": "^15.1.0",
"aws-sns-publish": "^3.3.0",
"dynamodb": "^1.2.0",
"express": "^4.17.1"
}
But I see that version 2.496.0 is installed, as required by this library. However this library specifies "^2.186.x"
for the version of aws-sdk it needs. Perhaps this bug is reason enough to change this? Either,
a. strictly peg it to a 2.186.something release (maybe ~2.186.0
would be acceptable)
b. specify ~2.497.0
, or a strict 2.497.0
Package version: 1.2.0
node version: 10.16.0
Take this code:
Running this with
node index.js
results toBut hardcoding the credentials like as follows:
has no problems.
What gave me the hint to try spelling out the JSON in code is aws/aws-sdk-js#2534.
Why does this happen and are there any workarounds to specifying JSON files for credentials? Is this a fault with this dynamodb package or should I air my woes in aws/aws-sdk-js? I could work with the hardcoded credentials for now but later on reading from JSON files would be really preferred.
UPDATE:
Upgrading aws-sdk to 2.497.0 or downgrading to 2.186.0 helps with the config loading part. But then the same error crops up when I try to insert anything to DynamoDB:
The exact error being