DyanamoDB connection issue - aws-sdk for NodeJs

1

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.

Saru
已提問 2 年前檢視次數 644 次
4 個答案
3
已接受的答案

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

AWS
Ted_Z
已回答 2 年前
  • MY GOD! That was a typo, aaahggg! Thank you so much for the input, you've saved me several days!

2

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:

CodeRegion
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)
profile pictureAWS
專家
已回答 2 年前
0

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.

已回答 2 年前
0

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

Saru
已回答 2 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南