diff --git a/.projenrc.ts b/.projenrc.ts index ff1be9bbb..d556ee164 100644 --- a/.projenrc.ts +++ b/.projenrc.ts @@ -67,12 +67,17 @@ function sdkDep(name: string) { /** * Same as `sdkDepForLib`, but for smithy + * + * The minimum is 4.3.0 because that's where AdaptiveRetryStrategy starts accepting the `maxAttempts` + * and `backoff` options we pass: + * https://github.com/smithy-lang/smithy-typescript/pull/1922/changes#diff-9fc896562a39cfba7f662ba86c13f140d4245ee45884b3fe9d79769e00a40ff7R14 + * https://github.com/smithy-lang/smithy-typescript/blob/%40smithy/util-retry%404.3.0/packages/util-retry/CHANGELOG.md?plain=1#L3-L8 */ function smithyDep(name: string) { if (!name.startsWith('@smithy/')) { throw new Error('Must be a Smithy package'); } - return `${name}@^4`; + return `${name}@^4.3.0`; } const BUNDLED_LICENSES = [ diff --git a/packages/@aws-cdk-testing/cli-integ/.projen/deps.json b/packages/@aws-cdk-testing/cli-integ/.projen/deps.json index f78ccdfc4..e96d2dd21 100644 --- a/packages/@aws-cdk-testing/cli-integ/.projen/deps.json +++ b/packages/@aws-cdk-testing/cli-integ/.projen/deps.json @@ -221,12 +221,12 @@ }, { "name": "@smithy/types", - "version": "^4", + "version": "^4.3.0", "type": "runtime" }, { "name": "@smithy/util-retry", - "version": "^4", + "version": "^4.3.0", "type": "runtime" }, { diff --git a/packages/@aws-cdk-testing/cli-integ/package.json b/packages/@aws-cdk-testing/cli-integ/package.json index 55384522f..c22f0fa1e 100644 --- a/packages/@aws-cdk-testing/cli-integ/package.json +++ b/packages/@aws-cdk-testing/cli-integ/package.json @@ -89,8 +89,8 @@ "@aws-sdk/credential-providers": "^3", "@cdklabs/cdk-atmosphere-client": "^0.0.128", "@octokit/rest": "^20", - "@smithy/types": "^4", - "@smithy/util-retry": "^4", + "@smithy/types": "^4.3.0", + "@smithy/util-retry": "^4.3.0", "chalk": "^4", "cross-spawn": "^7.0.6", "fast-glob": "^3.3.3", diff --git a/packages/@aws-cdk/cdk-assets-lib/.projen/deps.json b/packages/@aws-cdk/cdk-assets-lib/.projen/deps.json index 25bc9c978..41273e739 100644 --- a/packages/@aws-cdk/cdk-assets-lib/.projen/deps.json +++ b/packages/@aws-cdk/cdk-assets-lib/.projen/deps.json @@ -181,12 +181,12 @@ }, { "name": "@smithy/config-resolver", - "version": "^4", + "version": "^4.3.0", "type": "runtime" }, { "name": "@smithy/node-config-provider", - "version": "^4", + "version": "^4.3.0", "type": "runtime" }, { diff --git a/packages/@aws-cdk/cdk-assets-lib/package.json b/packages/@aws-cdk/cdk-assets-lib/package.json index e332455cd..29ca768ec 100644 --- a/packages/@aws-cdk/cdk-assets-lib/package.json +++ b/packages/@aws-cdk/cdk-assets-lib/package.json @@ -75,8 +75,8 @@ "@aws-sdk/client-sts": "^3", "@aws-sdk/credential-providers": "^3", "@aws-sdk/lib-storage": "^3", - "@smithy/config-resolver": "^4", - "@smithy/node-config-provider": "^4", + "@smithy/config-resolver": "^4.3.0", + "@smithy/node-config-provider": "^4.3.0", "cross-spawn": "^7.0.6", "fast-glob": "^3.3.3", "mime": "^2", diff --git a/packages/@aws-cdk/integ-runner/THIRD_PARTY_LICENSES b/packages/@aws-cdk/integ-runner/THIRD_PARTY_LICENSES index 456bdef79..3c502329a 100644 --- a/packages/@aws-cdk/integ-runner/THIRD_PARTY_LICENSES +++ b/packages/@aws-cdk/integ-runner/THIRD_PARTY_LICENSES @@ -8085,7 +8085,7 @@ SOFTWARE. ---------------- -** @smithy/config-resolver@4.6.5 - https://www.npmjs.com/package/@smithy/config-resolver/v/4.6.5 | Apache-2.0 +** @smithy/config-resolver@4.7.2 - https://www.npmjs.com/package/@smithy/config-resolver/v/4.7.2 | Apache-2.0 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -8701,7 +8701,7 @@ Apache License ---------------- -** @smithy/middleware-endpoint@4.6.5 - https://www.npmjs.com/package/@smithy/middleware-endpoint/v/4.6.5 | Apache-2.0 +** @smithy/middleware-endpoint@4.7.2 - https://www.npmjs.com/package/@smithy/middleware-endpoint/v/4.7.2 | Apache-2.0 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -8906,7 +8906,7 @@ Apache License ---------------- -** @smithy/node-config-provider@4.5.5 - https://www.npmjs.com/package/@smithy/node-config-provider/v/4.5.5 | Apache-2.0 +** @smithy/node-config-provider@4.6.2 - https://www.npmjs.com/package/@smithy/node-config-provider/v/4.6.2 | Apache-2.0 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -9316,7 +9316,7 @@ Apache License ---------------- -** @smithy/property-provider@4.4.5 - https://www.npmjs.com/package/@smithy/property-provider/v/4.4.5 | Apache-2.0 +** @smithy/property-provider@4.5.2 - https://www.npmjs.com/package/@smithy/property-provider/v/4.5.2 | Apache-2.0 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -9521,7 +9521,7 @@ Apache License ---------------- -** @smithy/shared-ini-file-loader@4.6.5 - https://www.npmjs.com/package/@smithy/shared-ini-file-loader/v/4.6.5 | Apache-2.0 +** @smithy/shared-ini-file-loader@4.7.2 - https://www.npmjs.com/package/@smithy/shared-ini-file-loader/v/4.7.2 | Apache-2.0 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -10137,7 +10137,7 @@ Apache License ---------------- -** @smithy/util-retry@4.5.5 - https://www.npmjs.com/package/@smithy/util-retry/v/4.5.5 | Apache-2.0 +** @smithy/util-retry@4.6.2 - https://www.npmjs.com/package/@smithy/util-retry/v/4.6.2 | Apache-2.0 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ diff --git a/packages/@aws-cdk/toolkit-lib/.projen/deps.json b/packages/@aws-cdk/toolkit-lib/.projen/deps.json index 6476f8f4d..a48869486 100644 --- a/packages/@aws-cdk/toolkit-lib/.projen/deps.json +++ b/packages/@aws-cdk/toolkit-lib/.projen/deps.json @@ -323,27 +323,27 @@ }, { "name": "@smithy/middleware-endpoint", - "version": "^4", + "version": "^4.3.0", "type": "runtime" }, { "name": "@smithy/property-provider", - "version": "^4", + "version": "^4.3.0", "type": "runtime" }, { "name": "@smithy/shared-ini-file-loader", - "version": "^4", + "version": "^4.3.0", "type": "runtime" }, { "name": "@smithy/util-retry", - "version": "^4", + "version": "^4.3.0", "type": "runtime" }, { "name": "@smithy/util-waiter", - "version": "^4", + "version": "^4.3.0", "type": "runtime" }, { diff --git a/packages/@aws-cdk/toolkit-lib/lib/api/aws-auth/awscli-compatible.ts b/packages/@aws-cdk/toolkit-lib/lib/api/aws-auth/awscli-compatible.ts index f4901b6c1..53ab03b90 100644 --- a/packages/@aws-cdk/toolkit-lib/lib/api/aws-auth/awscli-compatible.ts +++ b/packages/@aws-cdk/toolkit-lib/lib/api/aws-auth/awscli-compatible.ts @@ -156,7 +156,7 @@ export class AwsCliCompatible { */ public async region(maybeProfile?: string): Promise { const defaultRegion = 'us-east-1'; - const profile = maybeProfile || process.env.AWS_PROFILE || process.env.AWS_DEFAULT_PROFILE || 'default'; + const profile = resolveProfile(maybeProfile); const region = process.env.AWS_REGION || @@ -297,3 +297,10 @@ export function sdkRequestHandler(agent?: Agent): RequestHandlerSettings { httpAgent: agent, }; } + +/** + * The profile the AWS CLI would use: the given one, then the environment, then `default` + */ +export function resolveProfile(maybeProfile?: string): string { + return maybeProfile || process.env.AWS_PROFILE || process.env.AWS_DEFAULT_PROFILE || 'default'; +} diff --git a/packages/@aws-cdk/toolkit-lib/lib/api/aws-auth/private/index.ts b/packages/@aws-cdk/toolkit-lib/lib/api/aws-auth/private/index.ts index c00611d39..0f36fd8d2 100644 --- a/packages/@aws-cdk/toolkit-lib/lib/api/aws-auth/private/index.ts +++ b/packages/@aws-cdk/toolkit-lib/lib/api/aws-auth/private/index.ts @@ -1,6 +1,7 @@ export * from '../sdk'; export * from '../sdk-provider'; export * from '../sdk-logger'; +export * from '../retry'; // temporary testing exports export { AccountAccessKeyCache } from '../account-cache'; diff --git a/packages/@aws-cdk/toolkit-lib/lib/api/aws-auth/retry.ts b/packages/@aws-cdk/toolkit-lib/lib/api/aws-auth/retry.ts new file mode 100644 index 000000000..5015d6a1a --- /dev/null +++ b/packages/@aws-cdk/toolkit-lib/lib/api/aws-auth/retry.ts @@ -0,0 +1,153 @@ +import { loadSharedConfigFiles } from '@smithy/shared-ini-file-loader'; +import { AdaptiveRetryStrategy, ConfiguredRetryStrategy } from '@smithy/util-retry'; +import type { SdkRetrySettings } from './types'; +import { ToolkitError } from '../../toolkit/toolkit-error'; + +/** + * The retry strategies the CLI can hand to an SDK client + */ +export type SdkRetryStrategy = ConfiguredRetryStrategy | AdaptiveRetryStrategy; + +/** + * Build the retry strategy for an SDK client + * + * Passing an explicit `retryStrategy` to an SDK client makes the SDK ignore the user's retry + * configuration, so we apply the user's settings here and fall back to `defaultMaxAttempts` + * when they have not set one. The backoff schedule is not user-configurable: there is no + * standard setting for it, and we tune it per client. + * + * The strategy holds per-client state (the retry quota, and in adaptive mode the client-side + * rate limiter), so don't share one across services: throttling on one would slow the others. + * + * @param defaultMaxAttempts - total number of attempts, including the initial call, if the user has not set one + * @param backoffMs - delay in milliseconds before the given attempt + * @param settings - the user's retry settings + */ +export function sdkRetryStrategy( + defaultMaxAttempts: number, + backoffMs: (attempt: number) => number, + settings: SdkRetrySettings, +): SdkRetryStrategy { + const maxAttempts = settings.maxAttempts ?? defaultMaxAttempts; + + switch (settings.mode) { + case undefined: + case 'standard': + // Standard mode with our own backoff schedule + return new ConfiguredRetryStrategy(maxAttempts, backoffMs); + case 'adaptive': + return new AdaptiveRetryStrategy(maxAttempts, { + maxAttempts, + backoff: { + // The SDK passes the number of completed attempts; our schedule is keyed on the next one, + // which matches how `ConfiguredRetryStrategy` calls its backoff function. + computeNextBackoffDelay: (completedAttempts: number) => backoffMs(completedAttempts + 1), + // The delay base is baked into our backoff function + setDelayBase: () => undefined, + }, + }); + } +} + +/** + * Read the user's retry settings the way the AWS CLI v2 does + * + * Each setting is taken from its environment variable, and otherwise from the given profile in + * the shared config file. Unlike the AWS CLI v2, an empty environment variable counts as unset, + * like in the JavaScript SDK: CI templates often pass unset variables through that way. + */ +export async function retrySettings(profile: string): Promise { + const fromConfig = await retrySettingsFromConfig(profile); + const maxAttempts = process.env.AWS_MAX_ATTEMPTS || fromConfig.maxAttempts; + const mode = process.env.AWS_RETRY_MODE || fromConfig.mode; + validateMaxAttempts(maxAttempts); + validateMode(mode); + return { maxAttempts: maxAttempts === undefined ? undefined : Number(maxAttempts), mode }; +} + +/** + * Validate max attempts the way the AWS CLI v2 does: a whole number of at least 1 + * + * The AWS CLI parses with Python's `int()`, which also rejects numeric formats that `Number` + * accepts, like '0x10', '1e2' or '3.0'. We accept those: nobody writes them by accident. + * + * @see https://github.com/aws/aws-cli/blob/c6a386c0cc58c14eaf6ac11191ab59afdbc832b7/awscli/botocore/configprovider.py#L145 + * @see https://github.com/aws/aws-cli/blob/c6a386c0cc58c14eaf6ac11191ab59afdbc832b7/awscli/botocore/config.py#L400-L403 + */ +export function validateMaxAttempts(maxAttempts: string | number | undefined): void { + if (maxAttempts === undefined) { + return; + } + // `Number('')` and `Number(' ')` are 0, so blanks fail the minimum + const value = Number(maxAttempts); + if (!Number.isInteger(value) || value < 1) { + throw new ToolkitError('InvalidRetryConfiguration', `invalid value provided for max attempts: '${maxAttempts}', must be a whole number of at least 1`); + } +} + +/** + * Validate the retry mode the way the AWS CLI v2 does + * + * Stricter than the JavaScript SDK, which silently uses standard mode for anything that isn't + * exactly 'adaptive', typos included: + * https://github.com/smithy-lang/smithy-typescript/blob/d6725176da29286396c921bbe52d3bbd6b93a46b/packages/core/src/submodules/retry/middleware-retry/configurations.ts#L102-L114 + * + * We reject anything the AWS CLI v2 rejects, which includes 'legacy': it's a documented mode, but + * neither the JavaScript SDK nor the AWS CLI v2 supports it. + * + * @see https://github.com/aws/aws-cli/blob/c6a386c0cc58c14eaf6ac11191ab59afdbc832b7/awscli/botocore/config.py#L404-L405 + */ +export function validateMode(mode: string | undefined): asserts mode is SdkRetrySettings['mode'] { + if (mode !== undefined && mode !== 'standard' && mode !== 'adaptive') { + throw new ToolkitError( + 'InvalidRetryConfiguration', + `invalid value provided for retry mode: '${mode}', must be one of 'standard' or 'adaptive'`, + ); + } +} + +/** + * Read the raw retry settings from the given profile in the shared config file + * + * Only `~/.aws/config` is read: the credentials file may only hold credentials, and the + * retry settings are documented for the config file only. + * + * @see https://docs.aws.amazon.com/sdkref/latest/guide/feature-retry-behavior.html + */ +async function retrySettingsFromConfig(profile: string): Promise<{ maxAttempts?: string; mode?: string }> { + const { configFile } = await loadSharedConfigFiles({ ignoreCache: true }); + return { + maxAttempts: configFile?.[profile]?.max_attempts, + mode: configFile?.[profile]?.retry_mode, + }; +} + +/** + * Build a jittered exponential-backoff delay function whose result is capped at a maximum. + * + * An uncapped exponential backoff (`base * 2^attempt`) grows without bound as the + * number of retries increases. For the retry counts we use on the CloudFormation + * client in particular, that means the SDK can spend *tens of minutes* silently + * sleeping between retries when the service returns a retryable error such as + * `InternalFailure`. To the user that looks like the CLI has hung. Capping each + * individual delay at ~15s bounds the total retry time to a few minutes at worst, + * while still giving the SDK plenty of opportunity to ride out transient server + * problems or throttling. + * + * The delay is jittered because `ConfiguredRetryStrategy` replaces the SDK's own + * jittered backoff with whatever function it is handed. Without jitter, requests + * that were throttled at the same moment retry at the same moments, and a herd of + * pollers stays a herd instead of dispersing over the retry window. We use equal + * jitter - a random point in `[floor(delay/2), delay - 1]` - rather than the SDK's + * full jitter, so that the worst case stays under the capped delay above and the + * wait before a retry never collapses to nearly zero. + * + * @param baseMs - base delay in milliseconds (used in `baseMs * 2^attempt`) + * @param capMs - maximum delay in milliseconds; any computed delay larger than this is clamped + */ +export function cappedExponentialBackoff(baseMs: number, capMs: number): (attempt: number) => number { + return (attempt: number) => { + const delay = Math.min(baseMs * (2 ** attempt), capMs); + return Math.floor(delay / 2 + Math.random() * (delay / 2)); + }; +} diff --git a/packages/@aws-cdk/toolkit-lib/lib/api/aws-auth/sdk-provider.ts b/packages/@aws-cdk/toolkit-lib/lib/api/aws-auth/sdk-provider.ts index 16333f0ad..f86d03bb5 100644 --- a/packages/@aws-cdk/toolkit-lib/lib/api/aws-auth/sdk-provider.ts +++ b/packages/@aws-cdk/toolkit-lib/lib/api/aws-auth/sdk-provider.ts @@ -5,15 +5,17 @@ import { EnvironmentUtils, UNKNOWN_ACCOUNT, UNKNOWN_REGION } from '@aws-cdk/clou import type { ContextLookupRoleOptions } from '@aws-cdk/cloud-assembly-schema'; import type { AssumeRoleCommandInput } from '@aws-sdk/client-sts'; import { fromTemporaryCredentials } from '@aws-sdk/credential-providers'; -import { AwsCliCompatible } from './awscli-compatible'; +import { AwsCliCompatible, resolveProfile } from './awscli-compatible'; import type { RequestHandlerSettings } from './base-credentials'; import { cached } from './cached'; import { CredentialPlugins } from './credential-plugins'; import { makeCachingProvider } from './provider-caching'; +import { retrySettings } from './retry'; import { SDK } from './sdk'; import type { UserAgentMetadata } from './sdk'; import type { ISdkLogger } from './sdk-logger'; import { callTrace, traceMemberMethods } from './tracing'; +import type { SdkRetrySettings } from './types'; import { AuthenticationError } from '../../toolkit/toolkit-error'; import { formatErrorMessage } from '../../util'; import type { IoHelper } from '../io/private'; @@ -51,6 +53,11 @@ export interface SdkProviderOptions { * @default - no additional tokens */ readonly userAgentMetadata?: UserAgentMetadata[]; + + /** + * Retry settings configured by the user, see `retrySettings` + */ + readonly retry: SdkRetrySettings; } const CACHED_ACCOUNT = Symbol('cached_account'); @@ -111,17 +118,19 @@ export class SdkProvider { * Create a new SdkProvider which gets its defaults in a way that behaves like the AWS CLI does * * The AWS SDK for JS behaves slightly differently from the AWS CLI in a number of ways; see the - * class `AwsCliCompatible` for the details. + * class `AwsCliCompatible` for the details. Retry settings are read from the environment and the + * profile, see `retrySettings`. * * @param options - Options for the default SDK provider * @param profile - Profile to read from ~/.aws * @param region - Region override. Takes priority over environment variables, profile config, and the us-east-1 default. * @returns a configured SdkProvider */ - public static async withAwsCliCompatibleDefaults(options: SdkProviderOptions, profile?: string, region?: string) { + public static async withAwsCliCompatibleDefaults(options: Omit, profile?: string, region?: string) { callTrace(SdkProvider.withAwsCliCompatibleDefaults.name, SdkProvider.constructor.name, options.logger); const config = await new AwsCliCompatible(options.ioHelper, options.requestHandler ?? {}, options.logger).baseConfig(profile, region); - return new SdkProvider(config.credentialProvider, config.defaultRegion, options); + const retry = await retrySettings(resolveProfile(profile)); + return new SdkProvider(config.credentialProvider, config.defaultRegion, { ...options, retry }); } public readonly defaultRegion: string; @@ -131,6 +140,7 @@ export class SdkProvider { private readonly ioHelper: IoHelper; private readonly logger?: ISdkLogger; private readonly userAgentMetadata: UserAgentMetadata[]; + private readonly retrySettings: SdkRetrySettings; public constructor( defaultCredentialProvider: SDKv3CompatibleCredentialProvider, @@ -143,6 +153,7 @@ export class SdkProvider { this.ioHelper = options.ioHelper; this.logger = options.logger; this.userAgentMetadata = options.userAgentMetadata ?? []; + this.retrySettings = options.retry; this.plugins = new CredentialPlugins(options.pluginHost ?? new PluginHost(), this.ioHelper); } @@ -415,7 +426,7 @@ export class SdkProvider { credProvider: SDKv3CompatibleCredentialProvider, region: string, ) { - const sdk = new SDK(credProvider, region, this.requestHandler, this.ioHelper, this.logger); + const sdk = new SDK(credProvider, region, this.requestHandler, this.ioHelper, this.retrySettings, this.logger); for (const metadata of this.userAgentMetadata) { sdk.appendCustomUserAgent(metadata); } diff --git a/packages/@aws-cdk/toolkit-lib/lib/api/aws-auth/sdk.ts b/packages/@aws-cdk/toolkit-lib/lib/api/aws-auth/sdk.ts index 4f9ace14d..634592f8a 100644 --- a/packages/@aws-cdk/toolkit-lib/lib/api/aws-auth/sdk.ts +++ b/packages/@aws-cdk/toolkit-lib/lib/api/aws-auth/sdk.ts @@ -416,14 +416,15 @@ import { import { GetCallerIdentityCommand, STSClient } from '@aws-sdk/client-sts'; import { Upload } from '@aws-sdk/lib-storage'; import { getEndpointFromInstructions } from '@smithy/middleware-endpoint'; -import { ConfiguredRetryStrategy } from '@smithy/util-retry'; import type { WaiterResult } from '@smithy/util-waiter'; import { AccountAccessKeyCache } from './account-cache'; import type { RequestHandlerSettings } from './base-credentials'; import { cachedAsync } from './cached'; +import { cappedExponentialBackoff, sdkRetryStrategy, type SdkRetryStrategy } from './retry'; import type { ISdkLogger } from './sdk-logger'; import type { Account } from './sdk-provider'; import { traceMemberMethods } from './tracing'; +import type { SdkRetrySettings } from './types'; import { defaultCliUserAgent } from './user-agent'; import { forceS3PathStyle } from '../../private/tools'; import { AuthenticationError, ToolkitError } from '../../toolkit/toolkit-error'; @@ -488,7 +489,7 @@ export interface ConfigurationOptions { region: string; credentials: SDKv3CompatibleCredentialProvider; requestHandler: RequestHandlerSettings; - retryStrategy: ConfiguredRetryStrategy; + retryStrategy: SdkRetryStrategy; customUserAgent: Array<[name: string, value?: string]>; logger?: ISdkLogger; s3DisableBodySigning?: boolean; @@ -694,7 +695,7 @@ export interface IStepFunctionsClient { export class SDK { public readonly currentRegion: string; - private readonly baseConfig: Omit; + private readonly baseConfig: Omit; /** * The legacy User-Agent string, sent as the first token @@ -708,7 +709,7 @@ export class SDK { /** * STS is used to check credential validity, don't do too many retries. */ - private readonly stsRetryStrategy = new ConfiguredRetryStrategy(3, (attempt) => 100 * (2 ** attempt)); + private readonly stsRetryStrategy: SdkRetryStrategy; /** * Whether we have proof that the credentials have not expired @@ -729,6 +730,7 @@ export class SDK { region: string, requestHandler: RequestHandlerSettings, ioHelper: IoHelper, + private readonly retrySettings: SdkRetrySettings, logger?: ISdkLogger, ) { const debugFn = async (msg: string) => ioHelper.defaults.debug(msg); @@ -738,9 +740,9 @@ export class SDK { region, credentials: credProvider, requestHandler, - retryStrategy: new ConfiguredRetryStrategy(7, cappedExponentialBackoff(300, 15_000)), logger: logger ? makeSdkLoggerSafeByBindingThis(logger) : undefined, }; + this.stsRetryStrategy = sdkRetryStrategy(3, cappedExponentialBackoff(100, 15_000), retrySettings); this.customUserAgent = defaultCliUserAgent(); this.currentRegion = region; } @@ -748,12 +750,17 @@ export class SDK { /** * The configuration to create SDK clients with * + * Every access builds a new retry strategy, so each client gets its own retry quota and + * adaptive rate limiter, as it would without an explicit strategy. STS clients are the + * exception: they share `stsRetryStrategy`, which is fine because they all call STS. + * * The legacy User-Agent string is passed through unchanged as the first token, * so it looks exactly like before. Metadata follows as separate tokens. */ public get config(): ConfigurationOptions { return { ...this.baseConfig, + retryStrategy: sdkRetryStrategy(7, cappedExponentialBackoff(300, 15_000), this.retrySettings), customUserAgent: [ [this.customUserAgent], ...Array.from(this.userAgentMetadata, ([key, value]): [string, string] => [`aws-cdk/${key}`, value]), @@ -869,7 +876,7 @@ export class SDK { public cloudFormation(): ICloudFormationClient { const client = new CloudFormationClient({ ...this.config, - retryStrategy: new ConfiguredRetryStrategy(7, cappedExponentialBackoff(1000, 15_000)), + retryStrategy: sdkRetryStrategy(7, cappedExponentialBackoff(1000, 15_000), this.retrySettings), }); return { continueUpdateRollback: async ( @@ -1356,33 +1363,3 @@ function makeSdkLoggerSafeByBindingThis(logger: ISdkLogger): ISdkLogger { error: logger.error.bind(logger), }; } - -/** - * Build a jittered exponential-backoff delay function whose result is capped at a maximum. - * - * An uncapped exponential backoff (`base * 2^attempt`) grows without bound as the - * number of retries increases. For the retry counts we use on the CloudFormation - * client in particular (11 attempts), that means the SDK can spend *tens of - * minutes* silently sleeping between retries when the service returns a - * retryable error such as `InternalFailure`. To the user that looks like the - * CLI has hung. Capping each individual delay at ~15s bounds the total retry - * time to a few minutes at worst, while still giving the SDK plenty of - * opportunity to ride out transient server problems or throttling. - * - * The delay is jittered because `ConfiguredRetryStrategy` replaces the SDK's own - * jittered backoff with whatever function it is handed. Without jitter, requests - * that were throttled at the same moment retry at the same moments, and a herd of - * pollers stays a herd instead of dispersing over the retry window. We use equal - * jitter - a random point in `[floor(delay/2), delay - 1]` - rather than the SDK's - * full jitter, so that the worst case stays under the capped delay above and the - * wait before a retry never collapses to nearly zero. - * - * @param baseMs - base delay in milliseconds (used in `baseMs * 2^attempt`) - * @param capMs - maximum delay in milliseconds; any computed delay larger than this is clamped - */ -export function cappedExponentialBackoff(baseMs: number, capMs: number): (attempt: number) => number { - return (attempt: number) => { - const delay = Math.min(baseMs * (2 ** attempt), capMs); - return Math.floor(delay / 2 + Math.random() * (delay / 2)); - }; -} diff --git a/packages/@aws-cdk/toolkit-lib/lib/api/aws-auth/types.ts b/packages/@aws-cdk/toolkit-lib/lib/api/aws-auth/types.ts index 49ad6b7f5..9cbb6bdcc 100644 --- a/packages/@aws-cdk/toolkit-lib/lib/api/aws-auth/types.ts +++ b/packages/@aws-cdk/toolkit-lib/lib/api/aws-auth/types.ts @@ -16,6 +16,36 @@ export interface SdkConfig { * HTTP options for SDK */ readonly httpOptions?: SdkHttpOptions; + + /** + * Retry settings for SDK calls + * + * @default - the toolkit's per-client defaults + */ + readonly retry?: SdkRetrySettings; +} + +/** + * Retry settings for SDK calls + * + * The backoff schedule between attempts is not configurable. + */ +export interface SdkRetrySettings { + /** + * Total number of attempts, including the initial call + * + * Must be a whole number of at least 1. A value of 1 disables retries. + * + * @default - a per-client default chosen by the toolkit + */ + readonly maxAttempts?: number; + + /** + * The retry mode + * + * @default 'standard' + */ + readonly mode?: 'standard' | 'adaptive'; } /** diff --git a/packages/@aws-cdk/toolkit-lib/lib/toolkit/toolkit.ts b/packages/@aws-cdk/toolkit-lib/lib/toolkit/toolkit.ts index 104cc7ec1..811db148d 100644 --- a/packages/@aws-cdk/toolkit-lib/lib/toolkit/toolkit.ts +++ b/packages/@aws-cdk/toolkit-lib/lib/toolkit/toolkit.ts @@ -70,7 +70,7 @@ import { type SdkConfig, } from '../api/aws-auth'; import { sdkRequestHandler } from '../api/aws-auth/awscli-compatible'; -import { IoHostSdkLogger, SdkProvider } from '../api/aws-auth/private'; +import { IoHostSdkLogger, SdkProvider, validateMaxAttempts, validateMode } from '../api/aws-auth/private'; import { Bootstrapper } from '../api/bootstrap'; import type { ICloudAssemblySource, StackSelector } from '../api/cloud-assembly'; import { CachedCloudAssembly, StackSelectionStrategy } from '../api/cloud-assembly'; @@ -233,6 +233,8 @@ export class Toolkit extends CloudAssemblySourceBuilder { this.ioHost = withTrimmedWhitespace(ioHost); this.baseCredentials = props.sdkConfig?.baseCredentials ?? BaseCredentials.awsCliCompatible(); + validateMaxAttempts(props.sdkConfig?.retry?.maxAttempts); + validateMode(props.sdkConfig?.retry?.mode); this.unstableFeatures = props.unstableFeatures ?? []; } @@ -254,6 +256,7 @@ export class Toolkit extends CloudAssemblySourceBuilder { logger: new IoHostSdkLogger(ioHelper), pluginHost: this.pluginHost, requestHandler: clientConfig.requestHandler, + retry: this.props.sdkConfig?.retry ?? {}, }); } diff --git a/packages/@aws-cdk/toolkit-lib/package.json b/packages/@aws-cdk/toolkit-lib/package.json index b96e73cf0..b832e2a80 100644 --- a/packages/@aws-cdk/toolkit-lib/package.json +++ b/packages/@aws-cdk/toolkit-lib/package.json @@ -113,11 +113,11 @@ "@aws-sdk/credential-providers": "^3", "@aws-sdk/ec2-metadata-service": "^3", "@aws-sdk/lib-storage": "^3", - "@smithy/middleware-endpoint": "^4", - "@smithy/property-provider": "^4", - "@smithy/shared-ini-file-loader": "^4", - "@smithy/util-retry": "^4", - "@smithy/util-waiter": "^4", + "@smithy/middleware-endpoint": "^4.3.0", + "@smithy/property-provider": "^4.3.0", + "@smithy/shared-ini-file-loader": "^4.3.0", + "@smithy/util-retry": "^4.3.0", + "@smithy/util-waiter": "^4.3.0", "cdk-from-cfn": "^0.344.0", "chalk": "^4", "chokidar": "^4", diff --git a/packages/@aws-cdk/toolkit-lib/test/_helpers/env.ts b/packages/@aws-cdk/toolkit-lib/test/_helpers/env.ts new file mode 100644 index 000000000..e87532632 --- /dev/null +++ b/packages/@aws-cdk/toolkit-lib/test/_helpers/env.ts @@ -0,0 +1,24 @@ +/** + * Run code with some environment variables set, or unset where the value is `undefined` + * + * Only the given variables are touched, and each is restored to its original value afterwards. + */ +export async function withEnv(block: () => Promise, env: Record): Promise { + const original = Object.fromEntries(Object.keys(env).map((key) => [key, process.env[key]])); + setEnv(env); + try { + return await block(); + } finally { + setEnv(original); + } +} + +function setEnv(env: Record) { + for (const [key, value] of Object.entries(env)) { + if (value === undefined) { + delete process.env[key]; + } else { + process.env[key] = value; + } + } +} diff --git a/packages/@aws-cdk/toolkit-lib/test/_helpers/jest-setup-after-env.ts b/packages/@aws-cdk/toolkit-lib/test/_helpers/jest-setup-after-env.ts index 49c6190a1..0b2fbe8e2 100644 --- a/packages/@aws-cdk/toolkit-lib/test/_helpers/jest-setup-after-env.ts +++ b/packages/@aws-cdk/toolkit-lib/test/_helpers/jest-setup-after-env.ts @@ -34,6 +34,14 @@ import { isPromise } from 'util/types'; // These tests exercise the toolkit, not aws-cdk-lib's template linter. process.env.CDK_VALIDATION = 'false'; +// Keep the developer's own AWS settings out of the tests: retry settings from the shell, and the +// shared config and credentials files. They reach every test that builds an SdkProvider, and an +// invalid value makes provider creation fail. Tests that need any of them set them explicitly. +delete process.env.AWS_MAX_ATTEMPTS; +delete process.env.AWS_RETRY_MODE; +process.env.AWS_CONFIG_FILE = '/dev/null'; +process.env.AWS_SHARED_CREDENTIALS_FILE = '/dev/null'; + let tmpDir: string; let oldDir: string; diff --git a/packages/@aws-cdk/toolkit-lib/test/_helpers/mock-sdk.ts b/packages/@aws-cdk/toolkit-lib/test/_helpers/mock-sdk.ts index ba23b146d..4eaec9816 100644 --- a/packages/@aws-cdk/toolkit-lib/test/_helpers/mock-sdk.ts +++ b/packages/@aws-cdk/toolkit-lib/test/_helpers/mock-sdk.ts @@ -150,6 +150,7 @@ export class MockSdkProvider extends SdkProvider { constructor() { super(FAKE_CREDENTIAL_CHAIN, 'bermuda-triangle-1337', { ioHelper: new TestIoHost().asHelper('sdk'), + retry: {}, }); } @@ -173,7 +174,7 @@ export class MockSdkProvider extends SdkProvider { */ export class MockSdk extends SDK { constructor() { - super(FAKE_CREDENTIAL_CHAIN, 'bermuda-triangle-1337', {}, new TestIoHost().asHelper('sdk')); + super(FAKE_CREDENTIAL_CHAIN, 'bermuda-triangle-1337', {}, new TestIoHost().asHelper('sdk'), {}); } public async currentAccount(): Promise { diff --git a/packages/@aws-cdk/toolkit-lib/test/api/aws-auth/sdk-provider.test.ts b/packages/@aws-cdk/toolkit-lib/test/api/aws-auth/sdk-provider.test.ts index 9568bb641..c7820e7cb 100644 --- a/packages/@aws-cdk/toolkit-lib/test/api/aws-auth/sdk-provider.test.ts +++ b/packages/@aws-cdk/toolkit-lib/test/api/aws-auth/sdk-provider.test.ts @@ -23,6 +23,7 @@ import { SdkProvider, AwsCliCompatible, defaultCliUserAgent } from '../../../lib import { PluginHost, Mode } from '../../../lib/api/plugin'; import { withMocked } from '../../_helpers/as-mock'; import bockfs from '../../_helpers/bockfs'; +import { withEnv } from '../../_helpers/env'; import { undoAllSdkMocks } from '../../_helpers/mock-sdk'; import { TestIoHost } from '../../_helpers/test-io-host'; @@ -169,7 +170,7 @@ describe('with intercepted network calls', () => { const error = new Error('Expired Token'); error.name = 'ExpiredToken'; const identityProvider = () => Promise.reject(error); - const provider = new SdkProvider(identityProvider, 'rgn', { ioHelper, pluginHost: pluginHost }); + const provider = new SdkProvider(identityProvider, 'rgn', { ioHelper, pluginHost: pluginHost, retry: {} }); const creds = await provider.baseCredentialsPartition({ ...env(account), region: 'rgn' }, Mode.ForReading); expect(creds).toBeUndefined(); @@ -770,6 +771,7 @@ test('SDKs created by the provider get the userAgentMetadata', () => { // GIVEN const provider = new SdkProvider(jest.fn(), 'rgn', { ioHelper, + retry: {}, userAgentMetadata: [{ key: 'agent', value: 'kiro' }, { key: 'ci', value: 'github-actions' }], }); @@ -780,6 +782,37 @@ test('SDKs created by the provider get the userAgentMetadata', () => { expect((sdk as any).userAgentMetadata).toEqual(new Map([['agent', 'kiro'], ['ci', 'github-actions']])); }); +test('SDKs created by the provider use the retry settings', () => { + // GIVEN + const provider = new SdkProvider(jest.fn(), 'rgn', { ioHelper, retry: { mode: 'adaptive' } }); + + // WHEN + const sdk = provider._makeSdk(jest.fn(), 'rgn'); + + // THEN + expect(sdkConfig(sdk).retryStrategy.mode).toBe('adaptive'); +}); + +test('every SDK client gets its own retry strategy', () => { + // GIVEN + const sdk = new SdkProvider(jest.fn(), 'rgn', { ioHelper, retry: { mode: 'adaptive' } })._makeSdk(jest.fn(), 'rgn'); + + // THEN - clients are built from the `config` getter, so it must return a new retry strategy on + // every access: strategies hold per-client state (retry quota, adaptive rate limiter), and the SDK + // itself creates one per client + expect(sdkConfig(sdk).retryStrategy).not.toBe(sdkConfig(sdk).retryStrategy); +}); + +test('withAwsCliCompatibleDefaults reads retry settings from the given profile', () => { + bockfs({ '/home/me/.aws/config': '[profile ci]\nretry_mode = adaptive\n' }); + + return withEnv(async () => { + const provider = await SdkProvider.withAwsCliCompatibleDefaults({ ioHelper, pluginHost }, 'ci'); + + expect(sdkConfig(provider._makeSdk(jest.fn(), 'rgn')).retryStrategy.mode).toBe('adaptive'); + }, { AWS_CONFIG_FILE: bockfs.path('/home/me/.aws/config') }); +}); + /** * Use object hackery to get the credentials out of the SDK object */ diff --git a/packages/@aws-cdk/toolkit-lib/test/api/aws-auth/sdk-retry.test.ts b/packages/@aws-cdk/toolkit-lib/test/api/aws-auth/sdk-retry.test.ts index 9f3be6363..99cf49341 100644 --- a/packages/@aws-cdk/toolkit-lib/test/api/aws-auth/sdk-retry.test.ts +++ b/packages/@aws-cdk/toolkit-lib/test/api/aws-auth/sdk-retry.test.ts @@ -1,4 +1,11 @@ -import { cappedExponentialBackoff } from '../../../lib/api/aws-auth/private'; +import { AdaptiveRetryStrategy, type ConfiguredRetryStrategy } from '@smithy/util-retry'; +import { + cappedExponentialBackoff, + retrySettings, + sdkRetryStrategy, +} from '../../../lib/api/aws-auth/private'; +import bockfs from '../../_helpers/bockfs'; +import { withEnv } from '../../_helpers/env'; /** * The top of the jitter window is the delay the schedule asks for, so mocking @@ -98,3 +105,104 @@ describe(cappedExponentialBackoff, () => { expect(backoff(2)).toBe(400); }); }); + +/** + * The configured max attempts; the two strategies expose it under different names + */ +function maxAttemptsOf(strategy: ConfiguredRetryStrategy | AdaptiveRetryStrategy) { + return strategy instanceof AdaptiveRetryStrategy ? strategy.maxAttemptsProvider() : strategy.maxAttempts(); +} + +describe(sdkRetryStrategy, () => { + /** + * A zero-delay backoff, so retries in these tests don't actually sleep + */ + let backoffMs: jest.Mock; + + beforeEach(() => { + backoffMs = jest.fn().mockReturnValue(0); + }); + + /** + * Ask the strategy for a retry after one failed attempt + */ + async function retryOnce(strategy: ConfiguredRetryStrategy | AdaptiveRetryStrategy) { + const token = await strategy.acquireInitialRetryToken('scope'); + return strategy.refreshRetryTokenForRetry(token as any, { errorType: 'TRANSIENT' } as any); + } + + test('standard mode uses the configured attempts and our backoff', async () => { + const strategy = sdkRetryStrategy(7, backoffMs, { maxAttempts: 2 }); + + await expect(maxAttemptsOf(strategy)).resolves.toBe(2); + await retryOnce(strategy); + expect(backoffMs).toHaveBeenCalledWith(1); + }); + + test('adaptive mode uses the configured attempts and our backoff', async () => { + const strategy = sdkRetryStrategy(7, backoffMs, { mode: 'adaptive', maxAttempts: 2 }); + + expect(strategy).toBeInstanceOf(AdaptiveRetryStrategy); + await expect(maxAttemptsOf(strategy)).resolves.toBe(2); + await retryOnce(strategy); + // Same attempt numbering as ConfiguredRetryStrategy + expect(backoffMs).toHaveBeenCalledWith(1); + }); +}); + +describe(retrySettings, () => { + afterEach(() => { + bockfs.restore(); + }); + + /** + * Write an AWS config file and return its path, for AWS_CONFIG_FILE + */ + function configFile(contents: string) { + bockfs({ '/home/me/.aws/config': contents }); + return bockfs.path('/home/me/.aws/config'); + } + + test('reads settings from the profile in the config file', () => withEnv(async () => { + await expect(retrySettings('ci')).resolves.toEqual({ maxAttempts: 4, mode: 'adaptive' }); + }, { + AWS_CONFIG_FILE: configFile('[profile ci]\nmax_attempts = 4\nretry_mode = adaptive\n'), + })); + + test('environment variables take precedence over the profile, per setting', () => withEnv(async () => { + await expect(retrySettings('ci')).resolves.toEqual({ maxAttempts: 2, mode: 'adaptive' }); + }, { + AWS_CONFIG_FILE: configFile('[profile ci]\nmax_attempts = 4\nretry_mode = adaptive\n'), + AWS_MAX_ATTEMPTS: '2', + })); + + test('empty environment variables fall back to the profile', () => withEnv(async () => { + await expect(retrySettings('ci')).resolves.toEqual({ maxAttempts: 4, mode: 'adaptive' }); + }, { + AWS_CONFIG_FILE: configFile('[profile ci]\nmax_attempts = 4\nretry_mode = adaptive\n'), + AWS_MAX_ATTEMPTS: '', + AWS_RETRY_MODE: '', + })); + + test('rejects an invalid max attempts', () => withEnv(async () => { + await expect(retrySettings('default')).rejects.toThrow("invalid value provided for max attempts: 'lots', must be a whole number of at least 1"); + }, { AWS_MAX_ATTEMPTS: 'lots' })); + + test('rejects an invalid retry mode', () => withEnv(async () => { + await expect(retrySettings('default')).rejects.toThrow( + "invalid value provided for retry mode: 'adaptve', must be one of 'standard' or 'adaptive'", + ); + }, { AWS_RETRY_MODE: 'adaptve' })); + + test('rejects legacy retry mode, like the AWS CLI v2', () => withEnv(async () => { + await expect(retrySettings('default')).rejects.toThrow( + "invalid value provided for retry mode: 'legacy', must be one of 'standard' or 'adaptive'", + ); + }, { AWS_RETRY_MODE: 'legacy' })); + + test('validates settings from the profile', () => withEnv(async () => { + await expect(retrySettings('ci')).rejects.toThrow("invalid value provided for max attempts: '0', must be a whole number of at least 1"); + }, { + AWS_CONFIG_FILE: configFile('[profile ci]\nmax_attempts = 0\n'), + })); +}); diff --git a/packages/@aws-cdk/toolkit-lib/test/context-providers/amis.test.ts b/packages/@aws-cdk/toolkit-lib/test/context-providers/amis.test.ts index 4849c9481..3758da9e8 100644 --- a/packages/@aws-cdk/toolkit-lib/test/context-providers/amis.test.ts +++ b/packages/@aws-cdk/toolkit-lib/test/context-providers/amis.test.ts @@ -8,7 +8,7 @@ import { TestIoHost } from '../_helpers/test-io-host'; const mockSDK = new (class extends MockSdkProvider { public forEnvironment(): Promise { - return Promise.resolve({ sdk: new SDK(FAKE_CREDENTIAL_CHAIN, mockSDK.defaultRegion, {}, new TestIoHost().asHelper('deploy')), didAssumeRole: false }); + return Promise.resolve({ sdk: new SDK(FAKE_CREDENTIAL_CHAIN, mockSDK.defaultRegion, {}, new TestIoHost().asHelper('deploy'), {}), didAssumeRole: false }); } })(); diff --git a/packages/@aws-cdk/toolkit-lib/test/context-providers/availability-zones.test.ts b/packages/@aws-cdk/toolkit-lib/test/context-providers/availability-zones.test.ts index 8c39ebfb0..f0f574cd8 100644 --- a/packages/@aws-cdk/toolkit-lib/test/context-providers/availability-zones.test.ts +++ b/packages/@aws-cdk/toolkit-lib/test/context-providers/availability-zones.test.ts @@ -7,7 +7,7 @@ import { TestIoHost } from '../_helpers/test-io-host'; const mockSDK = new (class extends MockSdkProvider { public forEnvironment(): Promise { - return Promise.resolve({ sdk: new SDK(FAKE_CREDENTIAL_CHAIN, mockSDK.defaultRegion, {}, new TestIoHost().asHelper('deploy')), didAssumeRole: false }); + return Promise.resolve({ sdk: new SDK(FAKE_CREDENTIAL_CHAIN, mockSDK.defaultRegion, {}, new TestIoHost().asHelper('deploy'), {}), didAssumeRole: false }); } })(); diff --git a/packages/@aws-cdk/toolkit-lib/test/context-providers/endpoint-service-availability-zones.test.ts b/packages/@aws-cdk/toolkit-lib/test/context-providers/endpoint-service-availability-zones.test.ts index 402d3e6a7..72ecc2060 100644 --- a/packages/@aws-cdk/toolkit-lib/test/context-providers/endpoint-service-availability-zones.test.ts +++ b/packages/@aws-cdk/toolkit-lib/test/context-providers/endpoint-service-availability-zones.test.ts @@ -9,7 +9,7 @@ import { TestIoHost } from '../_helpers/test-io-host'; const mockSDK = new (class extends MockSdkProvider { public forEnvironment(): Promise { - return Promise.resolve({ sdk: new SDK(FAKE_CREDENTIAL_CHAIN, mockSDK.defaultRegion, {}, new TestIoHost().asHelper('deploy')), didAssumeRole: false }); + return Promise.resolve({ sdk: new SDK(FAKE_CREDENTIAL_CHAIN, mockSDK.defaultRegion, {}, new TestIoHost().asHelper('deploy'), {}), didAssumeRole: false }); } })(); diff --git a/packages/@aws-cdk/toolkit-lib/test/context-providers/hosted-zones.test.ts b/packages/@aws-cdk/toolkit-lib/test/context-providers/hosted-zones.test.ts index f38a50c9b..b4c4026fb 100644 --- a/packages/@aws-cdk/toolkit-lib/test/context-providers/hosted-zones.test.ts +++ b/packages/@aws-cdk/toolkit-lib/test/context-providers/hosted-zones.test.ts @@ -7,7 +7,7 @@ import { TestIoHost } from '../_helpers/test-io-host'; const mockSDK = new (class extends MockSdkProvider { public forEnvironment(): Promise { - return Promise.resolve({ sdk: new SDK(FAKE_CREDENTIAL_CHAIN, mockSDK.defaultRegion, {}, new TestIoHost().asHelper('deploy')), didAssumeRole: false }); + return Promise.resolve({ sdk: new SDK(FAKE_CREDENTIAL_CHAIN, mockSDK.defaultRegion, {}, new TestIoHost().asHelper('deploy'), {}), didAssumeRole: false }); } })(); diff --git a/packages/@aws-cdk/toolkit-lib/test/context-providers/load-balancers.test.ts b/packages/@aws-cdk/toolkit-lib/test/context-providers/load-balancers.test.ts index bcd104833..42ab642de 100644 --- a/packages/@aws-cdk/toolkit-lib/test/context-providers/load-balancers.test.ts +++ b/packages/@aws-cdk/toolkit-lib/test/context-providers/load-balancers.test.ts @@ -20,7 +20,7 @@ import { TestIoHost } from '../_helpers/test-io-host'; const mockSDK = new (class extends MockSdkProvider { public forEnvironment(): Promise { - return Promise.resolve({ sdk: new SDK(FAKE_CREDENTIAL_CHAIN, mockSDK.defaultRegion, {}, new TestIoHost().asHelper('deploy')), didAssumeRole: false }); + return Promise.resolve({ sdk: new SDK(FAKE_CREDENTIAL_CHAIN, mockSDK.defaultRegion, {}, new TestIoHost().asHelper('deploy'), {}), didAssumeRole: false }); } })(); diff --git a/packages/@aws-cdk/toolkit-lib/test/context-providers/security-groups.test.ts b/packages/@aws-cdk/toolkit-lib/test/context-providers/security-groups.test.ts index 4f29f7789..7931109fd 100644 --- a/packages/@aws-cdk/toolkit-lib/test/context-providers/security-groups.test.ts +++ b/packages/@aws-cdk/toolkit-lib/test/context-providers/security-groups.test.ts @@ -7,7 +7,7 @@ import { FAKE_CREDENTIAL_CHAIN, MockSdkProvider, mockEC2Client, restoreSdkMocksT const mockSDK = new (class extends MockSdkProvider { public forEnvironment(): Promise { - return Promise.resolve({ sdk: new SDK(FAKE_CREDENTIAL_CHAIN, mockSDK.defaultRegion, {}, new TestIoHost().asHelper('deploy')), didAssumeRole: false }); + return Promise.resolve({ sdk: new SDK(FAKE_CREDENTIAL_CHAIN, mockSDK.defaultRegion, {}, new TestIoHost().asHelper('deploy'), {}), didAssumeRole: false }); } })(); diff --git a/packages/@aws-cdk/toolkit-lib/test/context-providers/ssm-parameters.test.ts b/packages/@aws-cdk/toolkit-lib/test/context-providers/ssm-parameters.test.ts index 234915158..7fe2f9c4d 100644 --- a/packages/@aws-cdk/toolkit-lib/test/context-providers/ssm-parameters.test.ts +++ b/packages/@aws-cdk/toolkit-lib/test/context-providers/ssm-parameters.test.ts @@ -7,7 +7,7 @@ import { TestIoHost } from '../_helpers/test-io-host'; const mockSDK = new (class extends MockSdkProvider { public forEnvironment(): Promise { - return Promise.resolve({ sdk: new SDK(FAKE_CREDENTIAL_CHAIN, mockSDK.defaultRegion, {}, new TestIoHost().asHelper('deploy')), didAssumeRole: false }); + return Promise.resolve({ sdk: new SDK(FAKE_CREDENTIAL_CHAIN, mockSDK.defaultRegion, {}, new TestIoHost().asHelper('deploy'), {}), didAssumeRole: false }); } })(); diff --git a/packages/@aws-cdk/toolkit-lib/test/toolkit/base-credentials.test.ts b/packages/@aws-cdk/toolkit-lib/test/toolkit/base-credentials.test.ts index a6567326c..99124a11d 100644 --- a/packages/@aws-cdk/toolkit-lib/test/toolkit/base-credentials.test.ts +++ b/packages/@aws-cdk/toolkit-lib/test/toolkit/base-credentials.test.ts @@ -72,3 +72,20 @@ test.each([ delete process.env.AWS_REGION; }); + +test('sdkConfig.retry is used for SDK calls', async () => { + makeSdk.mockRestore(); + const toolkit = new Toolkit({ ioHost, sdkConfig: { baseCredentials: BaseCredentials.none(), retry: { mode: 'adaptive' } } }); + + // Use object hackery to reach the SdkProvider and the SDK client config + const sdkProvider: SdkProvider = await (toolkit as any).sdkProvider('synth'); + const sdk = sdkProvider._makeSdk(jest.fn(), 'rgn'); + + expect((sdk as any).config.retryStrategy.mode).toBe('adaptive'); +}); + +test('invalid sdkConfig.retry is rejected when the Toolkit is created', () => { + expect(() => new Toolkit({ ioHost, sdkConfig: { retry: { maxAttempts: 0 } } })).toThrow( + "invalid value provided for max attempts: '0', must be a whole number of at least 1", + ); +}); diff --git a/packages/aws-cdk/.projen/deps.json b/packages/aws-cdk/.projen/deps.json index d3448cb21..f172f5581 100644 --- a/packages/aws-cdk/.projen/deps.json +++ b/packages/aws-cdk/.projen/deps.json @@ -339,37 +339,37 @@ }, { "name": "@smithy/middleware-endpoint", - "version": "^4", + "version": "^4.3.0", "type": "runtime" }, { "name": "@smithy/property-provider", - "version": "^4", + "version": "^4.3.0", "type": "runtime" }, { "name": "@smithy/shared-ini-file-loader", - "version": "^4", + "version": "^4.3.0", "type": "runtime" }, { "name": "@smithy/smithy-client", - "version": "^4", + "version": "^4.3.0", "type": "runtime" }, { "name": "@smithy/types", - "version": "^4", + "version": "^4.3.0", "type": "runtime" }, { "name": "@smithy/util-retry", - "version": "^4", + "version": "^4.3.0", "type": "runtime" }, { "name": "@smithy/util-waiter", - "version": "^4", + "version": "^4.3.0", "type": "runtime" }, { diff --git a/packages/aws-cdk/THIRD_PARTY_LICENSES b/packages/aws-cdk/THIRD_PARTY_LICENSES index af0e8cfab..5d833bdc1 100644 --- a/packages/aws-cdk/THIRD_PARTY_LICENSES +++ b/packages/aws-cdk/THIRD_PARTY_LICENSES @@ -8156,7 +8156,7 @@ SOFTWARE. ---------------- -** @smithy/config-resolver@4.6.5 - https://www.npmjs.com/package/@smithy/config-resolver/v/4.6.5 | Apache-2.0 +** @smithy/config-resolver@4.7.2 - https://www.npmjs.com/package/@smithy/config-resolver/v/4.7.2 | Apache-2.0 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -8772,7 +8772,7 @@ Apache License ---------------- -** @smithy/middleware-endpoint@4.6.5 - https://www.npmjs.com/package/@smithy/middleware-endpoint/v/4.6.5 | Apache-2.0 +** @smithy/middleware-endpoint@4.7.2 - https://www.npmjs.com/package/@smithy/middleware-endpoint/v/4.7.2 | Apache-2.0 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -8977,7 +8977,7 @@ Apache License ---------------- -** @smithy/node-config-provider@4.5.5 - https://www.npmjs.com/package/@smithy/node-config-provider/v/4.5.5 | Apache-2.0 +** @smithy/node-config-provider@4.6.2 - https://www.npmjs.com/package/@smithy/node-config-provider/v/4.6.2 | Apache-2.0 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -9387,7 +9387,7 @@ Apache License ---------------- -** @smithy/property-provider@4.4.5 - https://www.npmjs.com/package/@smithy/property-provider/v/4.4.5 | Apache-2.0 +** @smithy/property-provider@4.5.2 - https://www.npmjs.com/package/@smithy/property-provider/v/4.5.2 | Apache-2.0 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -9592,7 +9592,7 @@ Apache License ---------------- -** @smithy/shared-ini-file-loader@4.6.5 - https://www.npmjs.com/package/@smithy/shared-ini-file-loader/v/4.6.5 | Apache-2.0 +** @smithy/shared-ini-file-loader@4.7.2 - https://www.npmjs.com/package/@smithy/shared-ini-file-loader/v/4.7.2 | Apache-2.0 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -10002,7 +10002,7 @@ Apache License ---------------- -** @smithy/smithy-client@4.14.5 - https://www.npmjs.com/package/@smithy/smithy-client/v/4.14.5 | Apache-2.0 +** @smithy/smithy-client@4.15.2 - https://www.npmjs.com/package/@smithy/smithy-client/v/4.15.2 | Apache-2.0 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -10414,7 +10414,7 @@ Apache License ---------------- -** @smithy/util-retry@4.5.5 - https://www.npmjs.com/package/@smithy/util-retry/v/4.5.5 | Apache-2.0 +** @smithy/util-retry@4.6.2 - https://www.npmjs.com/package/@smithy/util-retry/v/4.6.2 | Apache-2.0 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ diff --git a/packages/aws-cdk/lib/cli/proxy-agent.ts b/packages/aws-cdk/lib/cli/proxy-agent.ts index bc390ed9a..f023d66c3 100644 --- a/packages/aws-cdk/lib/cli/proxy-agent.ts +++ b/packages/aws-cdk/lib/cli/proxy-agent.ts @@ -2,6 +2,7 @@ import * as path from 'node:path'; import { loadSharedConfigFiles } from '@smithy/shared-ini-file-loader'; import * as fs from 'fs-extra'; import { ProxyAgent, proxies } from 'proxy-agent'; +import { resolveProfile } from '../api/aws-auth'; import { ToolkitError } from '../api-private-error'; /** @@ -185,8 +186,7 @@ export class ProxyAgentProvider { * of the active profile in the shared credentials/config files, then the `REQUESTS_CA_BUNDLE` * environment variable. * - * The profile is picked the way `AwsCliCompatible` in toolkit-lib picks it: `--profile`, then - * `AWS_PROFILE`, then `AWS_DEFAULT_PROFILE`, then `default`. + * The profile is picked with `resolveProfile`, the same way as for credentials and region. */ private async caBundlePathFromEnvironment(profile?: string): Promise<{ path: string; source: string } | undefined> { if (process.env.aws_ca_bundle) { @@ -196,7 +196,7 @@ export class ProxyAgentProvider { return { path: process.env.AWS_CA_BUNDLE, source: 'AWS_CA_BUNDLE' }; } - const profileName = profile || process.env.AWS_PROFILE || process.env.AWS_DEFAULT_PROFILE || 'default'; + const profileName = resolveProfile(profile); const profileCaBundle = await this.caBundlePathFromProfile(profileName); if (profileCaBundle) { return { path: profileCaBundle, source: `ca_bundle of profile '${profileName}'` }; diff --git a/packages/aws-cdk/package.json b/packages/aws-cdk/package.json index 47131f8a2..d3896fc92 100644 --- a/packages/aws-cdk/package.json +++ b/packages/aws-cdk/package.json @@ -116,13 +116,13 @@ "@aws-sdk/credential-providers": "^3", "@aws-sdk/ec2-metadata-service": "^3", "@aws-sdk/lib-storage": "^3", - "@smithy/middleware-endpoint": "^4", - "@smithy/property-provider": "^4", - "@smithy/shared-ini-file-loader": "^4", - "@smithy/smithy-client": "^4", - "@smithy/types": "^4", - "@smithy/util-retry": "^4", - "@smithy/util-waiter": "^4", + "@smithy/middleware-endpoint": "^4.3.0", + "@smithy/property-provider": "^4.3.0", + "@smithy/shared-ini-file-loader": "^4.3.0", + "@smithy/smithy-client": "^4.3.0", + "@smithy/types": "^4.3.0", + "@smithy/util-retry": "^4.3.0", + "@smithy/util-waiter": "^4.3.0", "camelcase": "^6", "cdk-from-cfn": "^0.344.0", "chalk": "^4", diff --git a/packages/aws-cdk/test/_helpers/jest-setup-after-env.ts b/packages/aws-cdk/test/_helpers/jest-setup-after-env.ts index e063a80c1..30d5f7bbb 100644 --- a/packages/aws-cdk/test/_helpers/jest-setup-after-env.ts +++ b/packages/aws-cdk/test/_helpers/jest-setup-after-env.ts @@ -27,6 +27,14 @@ import { isPromise } from 'util/types'; * */ +// Keep the developer's own AWS settings out of the tests: retry settings from the shell, and the +// shared config and credentials files. They reach every test that builds an SdkProvider, and an +// invalid value makes provider creation fail. Tests that need any of them set them explicitly. +delete process.env.AWS_MAX_ATTEMPTS; +delete process.env.AWS_RETRY_MODE; +process.env.AWS_CONFIG_FILE = '/dev/null'; +process.env.AWS_SHARED_CREDENTIALS_FILE = '/dev/null'; + let tmpDir: string; let oldDir: string; diff --git a/packages/aws-cdk/test/_helpers/mock-sdk.ts b/packages/aws-cdk/test/_helpers/mock-sdk.ts index 0db92735d..941877b67 100644 --- a/packages/aws-cdk/test/_helpers/mock-sdk.ts +++ b/packages/aws-cdk/test/_helpers/mock-sdk.ts @@ -153,6 +153,7 @@ export class MockSdkProvider extends SdkProvider { constructor() { super(FAKE_CREDENTIAL_CHAIN, 'bermuda-triangle-1337', { ioHelper: new TestIoHost().asHelper('sdk'), + retry: {}, }); } @@ -176,7 +177,7 @@ export class MockSdkProvider extends SdkProvider { */ export class MockSdk extends SDK { constructor() { - super(FAKE_CREDENTIAL_CHAIN, 'bermuda-triangle-1337', {}, new TestIoHost().asHelper('sdk')); + super(FAKE_CREDENTIAL_CHAIN, 'bermuda-triangle-1337', {}, new TestIoHost().asHelper('sdk'), {}); } } diff --git a/packages/cdk-assets/THIRD_PARTY_LICENSES b/packages/cdk-assets/THIRD_PARTY_LICENSES index 6e31780d6..37ae3d4a7 100644 --- a/packages/cdk-assets/THIRD_PARTY_LICENSES +++ b/packages/cdk-assets/THIRD_PARTY_LICENSES @@ -4173,7 +4173,7 @@ SOFTWARE. ---------------- -** @smithy/config-resolver@4.6.5 - https://www.npmjs.com/package/@smithy/config-resolver/v/4.6.5 | Apache-2.0 +** @smithy/config-resolver@4.7.2 - https://www.npmjs.com/package/@smithy/config-resolver/v/4.7.2 | Apache-2.0 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ @@ -4789,7 +4789,7 @@ Apache License ---------------- -** @smithy/node-config-provider@4.5.5 - https://www.npmjs.com/package/@smithy/node-config-provider/v/4.5.5 | Apache-2.0 +** @smithy/node-config-provider@4.6.2 - https://www.npmjs.com/package/@smithy/node-config-provider/v/4.6.2 | Apache-2.0 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ diff --git a/yarn.lock b/yarn.lock index df3245a8a..26142b5f5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -30,8 +30,8 @@ __metadata: "@cdklabs/cdk-atmosphere-client": "npm:^0.0.128" "@cdklabs/eslint-plugin": "npm:^2.0.28" "@octokit/rest": "npm:^20" - "@smithy/types": "npm:^4" - "@smithy/util-retry": "npm:^4" + "@smithy/types": "npm:^4.3.0" + "@smithy/util-retry": "npm:^4.3.0" "@stylistic/eslint-plugin": "npm:^3" "@types/fs-extra": "npm:^11" "@types/jest": "npm:^29.5.14" @@ -127,8 +127,8 @@ __metadata: "@aws-sdk/credential-providers": "npm:^3" "@aws-sdk/lib-storage": "npm:^3" "@cdklabs/eslint-plugin": "npm:^2.0.28" - "@smithy/config-resolver": "npm:^4" - "@smithy/node-config-provider": "npm:^4" + "@smithy/config-resolver": "npm:^4.3.0" + "@smithy/node-config-provider": "npm:^4.3.0" "@stylistic/eslint-plugin": "npm:^3" "@types/jest": "npm:^29.5.14" "@types/mime": "npm:^2" @@ -549,12 +549,12 @@ __metadata: "@jest/globals": "npm:^29.7.0" "@jest/types": "npm:^29.6.3" "@microsoft/api-extractor": "npm:^7.60.1" - "@smithy/middleware-endpoint": "npm:^4" - "@smithy/property-provider": "npm:^4" - "@smithy/shared-ini-file-loader": "npm:^4" - "@smithy/util-retry": "npm:^4" + "@smithy/middleware-endpoint": "npm:^4.3.0" + "@smithy/property-provider": "npm:^4.3.0" + "@smithy/shared-ini-file-loader": "npm:^4.3.0" + "@smithy/util-retry": "npm:^4.3.0" "@smithy/util-stream": "npm:^4.8.2" - "@smithy/util-waiter": "npm:^4" + "@smithy/util-waiter": "npm:^4.3.0" "@stylistic/eslint-plugin": "npm:^3" "@types/fs-extra": "npm:^11" "@types/jest": "npm:^29.5.14" @@ -4040,17 +4040,17 @@ __metadata: languageName: node linkType: hard -"@smithy/config-resolver@npm:^4": - version: 4.6.5 - resolution: "@smithy/config-resolver@npm:4.6.5" +"@smithy/config-resolver@npm:^4.3.0": + version: 4.7.2 + resolution: "@smithy/config-resolver@npm:4.7.2" dependencies: - "@smithy/core": "npm:^3.29.0" + "@smithy/core": "npm:^3.33.2" tslib: "npm:^2.6.2" - checksum: 10c0/fd2bce8497861f8b5449765c5a6926195a7dd3299e9b697d5f146b3bd892535e42fe5d4537793dd3de51cf98d78ca1f26e1db46bb1680eb83767f7bf14c744e5 + checksum: 10c0/ca61aba7cf9655ecd98a2bb883d94ee089fc1ebb3ec0e6c36f9db89a566bc7320bd5088720336d3fa4a8ddc82d3bc08d691859026f7bed0c1e815056ec250753 languageName: node linkType: hard -"@smithy/core@npm:^3.29.0, @smithy/core@npm:^3.33.2, @smithy/core@npm:^3.36.0, @smithy/core@npm:^3.38.0, @smithy/core@npm:^3.39.0, @smithy/core@npm:^3.40.0": +"@smithy/core@npm:^3.33.2, @smithy/core@npm:^3.36.0, @smithy/core@npm:^3.38.0, @smithy/core@npm:^3.39.0, @smithy/core@npm:^3.40.0": version: 3.40.0 resolution: "@smithy/core@npm:3.40.0" dependencies: @@ -4094,23 +4094,23 @@ __metadata: languageName: node linkType: hard -"@smithy/middleware-endpoint@npm:^4": - version: 4.6.5 - resolution: "@smithy/middleware-endpoint@npm:4.6.5" +"@smithy/middleware-endpoint@npm:^4.3.0": + version: 4.7.2 + resolution: "@smithy/middleware-endpoint@npm:4.7.2" dependencies: - "@smithy/core": "npm:^3.29.0" + "@smithy/core": "npm:^3.33.2" tslib: "npm:^2.6.2" - checksum: 10c0/3a468a6ba53953eb7162388fc5355b33752e93a36e45ea2f2f84da6b1bb0a5c7c36baf125c8c75a8b65684f1a6e45c88c562722822dfe3499e1f8e2fdbaec59d + checksum: 10c0/0b90badc6d0314b789f2748ae5afc721e908d05c9b5c9007bf9ef696245a96864baf10cbea9c7cc04d082bdad92c0a328953d66cce7b51c5196ffe171501a0db languageName: node linkType: hard -"@smithy/node-config-provider@npm:^4": - version: 4.5.5 - resolution: "@smithy/node-config-provider@npm:4.5.5" +"@smithy/node-config-provider@npm:^4.3.0": + version: 4.6.2 + resolution: "@smithy/node-config-provider@npm:4.6.2" dependencies: - "@smithy/core": "npm:^3.29.0" + "@smithy/core": "npm:^3.33.2" tslib: "npm:^2.6.2" - checksum: 10c0/709537f42625422acf9ea6e727efaf3785c2cf889f390679a7d832b2fcb618232f457e0a4ea8161bb5c70226e4defb7a5b5f23d346734fff26f694908773f703 + checksum: 10c0/4ca8e6cf20230059c0424e8707d19e347634fa2edd69f3c8ff2bc0bcdb53c3ef3cfe6a6d8ec38b9daf9d89aad0db5f666d00a5e42f07b1675a300e14863c9c90 languageName: node linkType: hard @@ -4125,23 +4125,23 @@ __metadata: languageName: node linkType: hard -"@smithy/property-provider@npm:^4": - version: 4.4.5 - resolution: "@smithy/property-provider@npm:4.4.5" +"@smithy/property-provider@npm:^4.3.0": + version: 4.5.2 + resolution: "@smithy/property-provider@npm:4.5.2" dependencies: - "@smithy/core": "npm:^3.29.0" + "@smithy/core": "npm:^3.33.2" tslib: "npm:^2.6.2" - checksum: 10c0/bc8e6128b12ca8eacac980d598e0bb88daafb4e644185c964276a0407cd4d19c25894b9f8c5cea9a14188c1f5905d49d348c0ae72ad372509efcaff04e55c041 + checksum: 10c0/a778f1f44cff3f269ad0364b26f48c550a823a0f84990979289f8395b37276f9db509ed3bdad7ecd9e0612ec0517254a41ab3f07336c7b7d0e86a108c689015b languageName: node linkType: hard -"@smithy/shared-ini-file-loader@npm:^4": - version: 4.6.5 - resolution: "@smithy/shared-ini-file-loader@npm:4.6.5" +"@smithy/shared-ini-file-loader@npm:^4.3.0": + version: 4.7.2 + resolution: "@smithy/shared-ini-file-loader@npm:4.7.2" dependencies: - "@smithy/core": "npm:^3.29.0" + "@smithy/core": "npm:^3.33.2" tslib: "npm:^2.6.2" - checksum: 10c0/f6983638e0c795e06382b2615f373043a0157edfcdf8aaf0a9497bf5c05c4f00d787e4a0891b9163b6645fca54fa8c9e104c13fb329023e3f5df72b304b9fd1c + checksum: 10c0/c36a5b8528eb8a1bcc87b8878a80d54f41ef8551e3cc49de3974dd92335d76144b257fe657061fcf74750dd9c54cee1963cc2a0ba09a12608975a7389ddc8825 languageName: node linkType: hard @@ -4156,18 +4156,18 @@ __metadata: languageName: node linkType: hard -"@smithy/smithy-client@npm:^4": - version: 4.14.5 - resolution: "@smithy/smithy-client@npm:4.14.5" +"@smithy/smithy-client@npm:^4.3.0": + version: 4.15.2 + resolution: "@smithy/smithy-client@npm:4.15.2" dependencies: - "@smithy/core": "npm:^3.29.0" - "@smithy/types": "npm:^4.15.1" + "@smithy/core": "npm:^3.33.2" + "@smithy/types": "npm:^4.17.2" tslib: "npm:^2.6.2" - checksum: 10c0/6d6a385f8198f6396e879ead608885db1e29661af8cd70599748a820e4c4359ecb9b1ead0bd0cf0ede6c570ce5de32bb3ce437c536b3e48868688a6f9a6fdfca + checksum: 10c0/1a1e1a667c509ae811c4682dceb9a7ebd47affa7f7192e48df79e127988b788bc03e7d9929fcaa1dedb20897ddc3002e319498e8d33837e6da91cd8a34ac6589 languageName: node linkType: hard -"@smithy/types@npm:^4, @smithy/types@npm:^4.15.1, @smithy/types@npm:^4.17.2, @smithy/types@npm:^4.19.0, @smithy/types@npm:^4.20.0": +"@smithy/types@npm:^4.17.2, @smithy/types@npm:^4.19.0, @smithy/types@npm:^4.20.0, @smithy/types@npm:^4.3.0": version: 4.20.0 resolution: "@smithy/types@npm:4.20.0" dependencies: @@ -4176,13 +4176,13 @@ __metadata: languageName: node linkType: hard -"@smithy/util-retry@npm:^4": - version: 4.5.5 - resolution: "@smithy/util-retry@npm:4.5.5" +"@smithy/util-retry@npm:^4.3.0": + version: 4.6.2 + resolution: "@smithy/util-retry@npm:4.6.2" dependencies: - "@smithy/core": "npm:^3.29.0" + "@smithy/core": "npm:^3.33.2" tslib: "npm:^2.6.2" - checksum: 10c0/984f758718f6950b847e4470feb047628c5cbe16af5a9b4134ba2362400011497d02c600112e5a79806f482690df1b7129534c30b0eaa1a47bc972127099a052 + checksum: 10c0/3eb066c24c900a59abc9289d5b4fee3ff9d6259407c9bcf3b2555bacc62713dcb456aa19d1511d59db91b5a60b1bd7a7d8ba6e3cb0e42cf8f3afa65513650dd6 languageName: node linkType: hard @@ -4196,13 +4196,13 @@ __metadata: languageName: node linkType: hard -"@smithy/util-waiter@npm:^4": - version: 4.5.5 - resolution: "@smithy/util-waiter@npm:4.5.5" +"@smithy/util-waiter@npm:^4.3.0": + version: 4.6.2 + resolution: "@smithy/util-waiter@npm:4.6.2" dependencies: - "@smithy/core": "npm:^3.29.0" + "@smithy/core": "npm:^3.33.2" tslib: "npm:^2.6.2" - checksum: 10c0/fc29b215df450c8b9eae507b5590646caa343d23833dc01f36ab0a57d794fbb124b58b7930eca8d56eb3f39d005ba80fdbb4ec22e673a19b36a72393934df947 + checksum: 10c0/1d7ac07df8aa869f242daeb03da495314d819c6304f6d67e5c628a4bd8412266e145ee4fb196340c3279b3d613f3b64c674816ac41199ed6e4544bdffcc53851 languageName: node linkType: hard @@ -5974,13 +5974,13 @@ __metadata: "@aws-sdk/ec2-metadata-service": "npm:^3" "@aws-sdk/lib-storage": "npm:^3" "@cdklabs/eslint-plugin": "npm:^2.0.28" - "@smithy/middleware-endpoint": "npm:^4" - "@smithy/property-provider": "npm:^4" - "@smithy/shared-ini-file-loader": "npm:^4" - "@smithy/smithy-client": "npm:^4" - "@smithy/types": "npm:^4" - "@smithy/util-retry": "npm:^4" - "@smithy/util-waiter": "npm:^4" + "@smithy/middleware-endpoint": "npm:^4.3.0" + "@smithy/property-provider": "npm:^4.3.0" + "@smithy/shared-ini-file-loader": "npm:^4.3.0" + "@smithy/smithy-client": "npm:^4.3.0" + "@smithy/types": "npm:^4.3.0" + "@smithy/util-retry": "npm:^4.3.0" + "@smithy/util-waiter": "npm:^4.3.0" "@stylistic/eslint-plugin": "npm:^3" "@types/fs-extra": "npm:^11" "@types/jest": "npm:^29.5.14"