DyanamoDB connection issue - aws-sdk for NodeJs
While connecting to DynamoDB via aws-sdk for NodeJs, i'm seeing below issue:
InvalidSignatureException: Credential should be scoped to a valid region, not 'eu-east-2'. at Request.extractError (/Users/saravanan_vij/Documents/Personal/GitHub/Backtester/node_modules/aws-sdk/lib/protocol/json.js:52:27) at Request.callListeners (/Users/saravanan_vij/Documents/Personal/GitHub/Backtester/node_modules/aws-sdk/lib/sequential_executor.js:106:20) at Request.emit (/Users/saravanan_vij/Documents/Personal/GitHub/Backtester/node_modules/aws-sdk/lib/sequential_executor.js:78:10) at Request.emit (/Users/saravanan_vij/Documents/Personal/GitHub/Backtester/node_modules/aws-sdk/lib/request.js:686:14) at Request.transition (/Users/saravanan_vij/Documents/Personal/GitHub/Backtester/node_modules/aws-sdk/lib/request.js:22:10) at AcceptorStateMachine.runTo (/Users/saravanan_vij/Documents/Personal/GitHub/Backtester/node_modules/aws-sdk/lib/state_machine.js:14:12) at /Users/saravanan_vij/Documents/Personal/GitHub/Backtester/node_modules/aws-sdk/lib/state_machine.js:26:10 at Request.<anonymous> (/Users/saravanan_vij/Documents/Personal/GitHub/Backtester/node_modules/aws-sdk/lib/request.js:38:9) at Request.<anonymous> (/Users/saravanan_vij/Documents/Personal/GitHub/Backtester/node_modules/aws-sdk/lib/request.js:688:12) at Request.callListeners (/Users/saravanan_vij/Documents/Personal/GitHub/Backtester/node_modules/aws-sdk/lib/sequential_executor.js:116:18) { code: 'InvalidSignatureException', time: 2021-12-30T17:22:35.364Z, requestId: '3CT4LSCT0395369U3SVVNMV4B3VV4KQNSO5AEMVJF66Q9ASUAAJG', statusCode: 400, retryable: false, retryDelay: 24.638717702395528
I cannot believe that I'm not able to resolve this issue still after spending several hours on it and its weird that nobody else has faced or logged it. Or maybe I'm doing something wrong.
Here's the config code:
AWS.config.update({ region: DynamoDBConfig.region, endpoint: DynamoDBConfig.endpoint, accessKeyId: DynamoDBConfig.accessKeyId,//process.env.AWS_ACCESS_KEY_ID, secretAccessKey: DynamoDBConfig.secretAccessKey//process.env.AWS_SECRET_ACCESS_KEY });
const dynamodb = new AWS.DynamoDB({region: DynamoDBConfig.region});
Note: The same code is working fine on the localhost DynamoDB.
Hi, it looks like the issue is with the region code you're using. eu-east-2 isn't listed on our region list:
https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.RegionsAndAvailabilityZones.html
It looks like you are using a region which does not exist. Check the value of your DynamoDBConfig.region
and ensure it points to a region listed here:
Code | Region |
---|---|
us-east-2 | US East (Ohio) |
us-east-1 | US East (N. Virginia) |
us-west-1 | US West (N. California) |
us-west-2 | US West (Oregon) |
af-south-1 | Africa (Cape Town) |
ap-east-1 | Asia Pacific (Hong Kong) |
ap-southeast-3 | Asia Pacific (Jakarta) |
ap-south-1 | Asia Pacific (Mumbai) |
ap-northeast-3 | Asia Pacific (Osaka) |
ap-northeast-2 | Asia Pacific (Seoul) |
ap-southeast-1 | Asia Pacific (Singapore) |
ap-southeast-2 | Asia Pacific (Sydney) |
ap-northeast-1 | Asia Pacific (Tokyo) |
ca-central-1 | Canada (Central) |
eu-central-1 | Europe (Frankfurt) |
eu-west-1 | Europe (Ireland) |
eu-west-2 | Europe (London) |
eu-south-1 | Europe (Milan) |
eu-west-3 | Europe (Paris) |
eu-north-1 | Europe (Stockholm) |
me-south-1 | Middle East (Bahrain) |
sa-east-1 | South America (São Paulo) |
Hi,
InvalidSignatureException
error is when your credentials for the IAM user may not have the right DynamoDB actions for that DynamoDB table or IAM user or for that specific region it is not authorised. As you have mentioned, on localhost it is working recheck the DynamoDB table or region it is using.
the issue was occurring because of the typo in the region where I had this: 'eu-east-2' instead of this: ''us-east-2'
Relevant questions
NodeJS Beanstalk EC2 HTTPS Load Balancing
asked 2 months ago[Amazon](500310) Invalid operation when setting parameter to bpchar (JDBC)
asked 2 years agoFIREWALL PORT 3443 ENABLED; NODEJS Listening; fail to connect.
asked 3 years agoCross Region private link
Accepted Answerasked 3 months agoCredential should be scoped to a valid region error
asked 4 years agoDyanamoDB connection issue - aws-sdk for NodeJs
Accepted Answerasked 5 months ago"Timeout waiting for an available tube" from Dax
asked a month agoDyanamoDB connection issue - aws-sdk for NodeJs - Inside Docker
Accepted Answerasked 4 months agoError - "A problem occurred while loading your page: Rate exceeded"
asked 3 years agoWill DynamoDB global tables be available soon in Paris/eu-west-3 region
asked 2 years ago
MY GOD! That was a typo, aaahggg! Thank you so much for the input, you've saved me several days!