Skip to content

Commit 8b3bf04

Browse files
authored
chore(idempotency): refactor aws sdk init logic (#1768)
1 parent 68fc758 commit 8b3bf04

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Diff for: packages/idempotency/src/persistence/DynamoDBPersistenceLayer.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,17 @@ class DynamoDBPersistenceLayer extends BasePersistenceLayer {
8181
this.staticPkValue =
8282
config.staticPkValue ?? `idempotency#${this.idempotencyKeyPrefix}`;
8383

84-
this.client = new DynamoDBClient(config?.clientConfig ?? {});
85-
if (config?.awsSdkV3Client) {
86-
if (isSdkClient(config.awsSdkV3Client)) {
87-
this.client = config.awsSdkV3Client;
88-
} else {
84+
if (config.awsSdkV3Client) {
85+
if (!isSdkClient(config.awsSdkV3Client)) {
8986
console.warn(
9087
'awsSdkV3Client is not an AWS SDK v3 client, using default client'
9188
);
89+
this.client = new DynamoDBClient(config.clientConfig ?? {});
90+
} else {
91+
this.client = config.awsSdkV3Client;
9292
}
93+
} else {
94+
this.client = new DynamoDBClient(config.clientConfig ?? {});
9395
}
9496
addUserAgentMiddleware(this.client, 'idempotency');
9597
}

0 commit comments

Comments
 (0)