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.
This commit is contained in:
parent
c717273996
commit
94720c10aa
|
@ -131,11 +131,12 @@ module DynamoModule {
|
||||||
|
|
||||||
constructor(config: DynamoDBConfig) {
|
constructor(config: DynamoDBConfig) {
|
||||||
this.config = config
|
this.config = config
|
||||||
if (!this.config.endpoint) {
|
if (this.config.endpoint && !this.config.endpoint.includes("localhost")) {
|
||||||
this.connect()
|
this.connect()
|
||||||
}
|
}
|
||||||
let options = {
|
let options = {
|
||||||
correctClockSkew: true,
|
correctClockSkew: true,
|
||||||
|
region: this.config.region || AWS_REGION,
|
||||||
endpoint: config.endpoint ? config.endpoint : undefined,
|
endpoint: config.endpoint ? config.endpoint : undefined,
|
||||||
}
|
}
|
||||||
this.client = new AWS.DynamoDB.DocumentClient(options)
|
this.client = new AWS.DynamoDB.DocumentClient(options)
|
||||||
|
|
Loading…
Reference in New Issue