By using AWS re:Post, you agree to the Terms of Use
/DyanamoDB connection issue - aws-sdk for NodeJs/

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.

4 Answers
Accepted Answer

Hi, it looks like the issue is with the region code you're using. eu-east-2 isn't listed on our region list:

answered 5 months ago
  • MY GOD! That was a typo, aaahggg! Thank you so much for the input, you've saved me several days!


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:

us-east-2US East (Ohio)
us-east-1US East (N. Virginia)
us-west-1US West (N. California)
us-west-2US West (Oregon)
af-south-1Africa (Cape Town)
ap-east-1Asia Pacific (Hong Kong)
ap-southeast-3Asia Pacific (Jakarta)
ap-south-1Asia Pacific (Mumbai)
ap-northeast-3Asia Pacific (Osaka)
ap-northeast-2Asia Pacific (Seoul)
ap-southeast-1Asia Pacific (Singapore)
ap-southeast-2Asia Pacific (Sydney)
ap-northeast-1Asia Pacific (Tokyo)
ca-central-1Canada (Central)
eu-central-1Europe (Frankfurt)
eu-west-1Europe (Ireland)
eu-west-2Europe (London)
eu-south-1Europe (Milan)
eu-west-3Europe (Paris)
eu-north-1Europe (Stockholm)
me-south-1Middle East (Bahrain)
sa-east-1South America (São Paulo)
answered 5 months ago


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.

answered 5 months ago

the issue was occurring because of the typo in the region where I had this: 'eu-east-2' instead of this: ''us-east-2'

answered 5 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions