Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): sts retry options are ignored #32227

Merged
merged 4 commits into from
Nov 21, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions packages/aws-cdk/lib/api/aws-auth/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
};
Comment on lines -533 to -536
Copy link
Contributor Author

@iliapolo iliapolo Nov 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maxRetries has been replaced with maxAttempts and retryDelayOptions doesn't exist. Replace with a strategy object instead.

See https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-smithy-middleware-retry/Interface/RetryInputConfig/

private readonly stsRetryStrategy = new ConfiguredRetryStrategy(3, (attempt) => 100 * 1000 * (2 ** attempt));

/**
* Whether we have proof that the credentials have not expired
Expand All @@ -553,7 +550,7 @@ export class SDK {
region,
credentials: _credentials,
requestHandler,
retryStrategy: new ConfiguredRetryStrategy(7, (attempt) => 300 * (2 ** attempt)),
retryStrategy: new ConfiguredRetryStrategy(7, (attempt) => 300 * 1000 * (2 ** attempt)),
customUserAgent: defaultCliUserAgent(),
};
this.currentRegion = region;
Expand Down Expand Up @@ -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);
Expand All @@ -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;
}
Expand Down
Loading