From 193ab8cf892a3d2a3dbafc6db9f7a1d246fab2ec Mon Sep 17 00:00:00 2001 From: Eli Polonsky Date: Thu, 21 Nov 2024 15:27:41 +0200 Subject: [PATCH] fix(cli): sts retry options are ignored (#32227) We were still using the SDK v2 properties, but SDK v3 uses different ones. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- packages/aws-cdk/lib/api/aws-auth/sdk.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/aws-cdk/lib/api/aws-auth/sdk.ts b/packages/aws-cdk/lib/api/aws-auth/sdk.ts index e8489776ceebc..9d28ed7958bd6 100644 --- a/packages/aws-cdk/lib/api/aws-auth/sdk.ts +++ b/packages/aws-cdk/lib/api/aws-auth/sdk.ts @@ -530,10 +530,7 @@ export class SDK { /** * STS is used to check credential validity, don't do too many retries. */ - private readonly stsRetryOptions = { - maxRetries: 3, - retryDelayOptions: { base: 100 }, - }; + private readonly stsRetryStrategy = new ConfiguredRetryStrategy(3, (attempt) => 100 * (2 ** attempt)); /** * Whether we have proof that the credentials have not expired @@ -950,7 +947,7 @@ export class SDK { debug('Looking up default account ID from STS'); const client = new STSClient({ ...this.config, - ...this.stsRetryOptions, + retryStrategy: this.stsRetryStrategy, }); const command = new GetCallerIdentityCommand({}); const result = await client.send(command); @@ -977,7 +974,7 @@ export class SDK { return; } - const client = new STSClient({ ...this.config, ...this.stsRetryOptions }); + const client = new STSClient({ ...this.config, retryStrategy: this.stsRetryStrategy }); await client.send(new GetCallerIdentityCommand({})); this._credentialsValidated = true; }