From 94720c10aa550521ee201264c0df0b3a61f50e67 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Tue, 12 Apr 2022 18:49:46 +0100 Subject: [PATCH] Fixing issue #5322 - when endpoint is specified for DynamoDB and not in a the region that the whole instance expects it will throw an odd credentials error - making sure connection is commenced everywhere other than localhost. --- packages/server/src/integrations/dynamodb.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/server/src/integrations/dynamodb.ts b/packages/server/src/integrations/dynamodb.ts index be3668a08a..9ce4201a1e 100644 --- a/packages/server/src/integrations/dynamodb.ts +++ b/packages/server/src/integrations/dynamodb.ts @@ -131,11 +131,12 @@ module DynamoModule { constructor(config: DynamoDBConfig) { this.config = config - if (!this.config.endpoint) { + if (this.config.endpoint && !this.config.endpoint.includes("localhost")) { this.connect() } let options = { correctClockSkew: true, + region: this.config.region || AWS_REGION, endpoint: config.endpoint ? config.endpoint : undefined, } this.client = new AWS.DynamoDB.DocumentClient(options)