diff --git a/packages/aws-cdk/lib/api/aws-auth/sdk.ts b/packages/aws-cdk/lib/api/aws-auth/sdk.ts index 9d28ed7958bd6..945b5f4513ad2 100644 --- a/packages/aws-cdk/lib/api/aws-auth/sdk.ts +++ b/packages/aws-cdk/lib/api/aws-auth/sdk.ts @@ -246,7 +246,7 @@ import { UpdateFunctionConfigurationCommand, type UpdateFunctionConfigurationCommandInput, type UpdateFunctionConfigurationCommandOutput, - waitUntilFunctionUpdated, + waitUntilFunctionUpdatedV2, } from '@aws-sdk/client-lambda'; import { GetHostedZoneCommand, @@ -841,7 +841,7 @@ export class SDK { delaySeconds: number, input: UpdateFunctionConfigurationCommandInput, ): Promise => { - return waitUntilFunctionUpdated( + return waitUntilFunctionUpdatedV2( { client, maxDelay: delaySeconds, diff --git a/packages/aws-cdk/test/api/hotswap/hotswap-test-setup.ts b/packages/aws-cdk/test/api/hotswap/hotswap-test-setup.ts index 8a5020b290170..7fbc2a4ab92d0 100644 --- a/packages/aws-cdk/test/api/hotswap/hotswap-test-setup.ts +++ b/packages/aws-cdk/test/api/hotswap/hotswap-test-setup.ts @@ -1,6 +1,6 @@ import * as cxapi from '@aws-cdk/cx-api'; import { ListStackResourcesCommand, StackResourceSummary, StackStatus } from '@aws-sdk/client-cloudformation'; -import { GetFunctionConfigurationCommand } from '@aws-sdk/client-lambda'; +import { GetFunctionCommand } from '@aws-sdk/client-lambda'; import { ICloudFormationClient, SuccessfulDeployStackResult } from '../../../lib/api'; import { HotswapMode, HotswapPropertyOverrides } from '../../../lib/api/hotswap/common'; import * as deployments from '../../../lib/api/hotswap-deployments'; @@ -109,8 +109,10 @@ export class HotswapMockSdkProvider extends MockSdkProvider { constructor(rootStackName?: string) { super(); - mockLambdaClient.on(GetFunctionConfigurationCommand).resolves({ - LastUpdateStatus: 'Successful', + mockLambdaClient.on(GetFunctionCommand).resolves({ + Configuration: { + LastUpdateStatus: 'Successful', + }, }); mockCloudFormationClient.on(ListStackResourcesCommand).callsFake((input) => { diff --git a/packages/aws-cdk/test/api/hotswap/lambda-functions-docker-hotswap-deployments.test.ts b/packages/aws-cdk/test/api/hotswap/lambda-functions-docker-hotswap-deployments.test.ts index bf42795ae497f..023627a429a04 100644 --- a/packages/aws-cdk/test/api/hotswap/lambda-functions-docker-hotswap-deployments.test.ts +++ b/packages/aws-cdk/test/api/hotswap/lambda-functions-docker-hotswap-deployments.test.ts @@ -1,4 +1,4 @@ -import { UpdateFunctionCodeCommand, waitUntilFunctionUpdated } from '@aws-sdk/client-lambda'; +import { UpdateFunctionCodeCommand, waitUntilFunctionUpdatedV2 } from '@aws-sdk/client-lambda'; import * as setup from './hotswap-test-setup'; import { HotswapMode } from '../../../lib/api/hotswap/common'; import { mockLambdaClient } from '../../util/mock-sdk'; @@ -9,7 +9,7 @@ jest.mock('@aws-sdk/client-lambda', () => { return { ...original, - waitUntilFunctionUpdated: jest.fn(), + waitUntilFunctionUpdatedV2: jest.fn(), }; }); @@ -116,7 +116,7 @@ describe.each([HotswapMode.FALL_BACK, HotswapMode.HOTSWAP_ONLY])('%p mode', (hot await hotswapMockSdkProvider.tryHotswapDeployment(hotswapMode, cdkStackArtifact); // THEN - expect(waitUntilFunctionUpdated).toHaveBeenCalledWith( + expect(waitUntilFunctionUpdatedV2).toHaveBeenCalledWith( expect.objectContaining({ minDelay: 5, maxDelay: 5, diff --git a/packages/aws-cdk/test/api/hotswap/lambda-functions-hotswap-deployments.test.ts b/packages/aws-cdk/test/api/hotswap/lambda-functions-hotswap-deployments.test.ts index a180e89d8d741..cf354a1aaa053 100644 --- a/packages/aws-cdk/test/api/hotswap/lambda-functions-hotswap-deployments.test.ts +++ b/packages/aws-cdk/test/api/hotswap/lambda-functions-hotswap-deployments.test.ts @@ -1,7 +1,7 @@ import { UpdateFunctionCodeCommand, UpdateFunctionConfigurationCommand, - waitUntilFunctionUpdated, + waitUntilFunctionUpdatedV2, } from '@aws-sdk/client-lambda'; import * as setup from './hotswap-test-setup'; import { HotswapMode } from '../../../lib/api/hotswap/common'; @@ -10,10 +10,9 @@ import { silentTest } from '../../util/silent'; jest.mock('@aws-sdk/client-lambda', () => { const original = jest.requireActual('@aws-sdk/client-lambda'); - return { ...original, - waitUntilFunctionUpdated: jest.fn(), + waitUntilFunctionUpdatedV2: jest.fn(), }; }); @@ -617,7 +616,7 @@ describe.each([HotswapMode.FALL_BACK, HotswapMode.HOTSWAP_ONLY])('%p mode', (hot // THEN expect(mockLambdaClient).toHaveReceivedCommand(UpdateFunctionCodeCommand); - expect(waitUntilFunctionUpdated).toHaveBeenCalledWith( + expect(waitUntilFunctionUpdatedV2).toHaveBeenCalledWith( expect.objectContaining({ minDelay: 1, maxDelay: 1, @@ -675,7 +674,7 @@ describe.each([HotswapMode.FALL_BACK, HotswapMode.HOTSWAP_ONLY])('%p mode', (hot await hotswapMockSdkProvider.tryHotswapDeployment(hotswapMode, cdkStackArtifact); // THEN - expect(waitUntilFunctionUpdated).toHaveBeenCalledWith( + expect(waitUntilFunctionUpdatedV2).toHaveBeenCalledWith( expect.objectContaining({ minDelay: 1, maxDelay: 1, @@ -733,7 +732,7 @@ describe.each([HotswapMode.FALL_BACK, HotswapMode.HOTSWAP_ONLY])('%p mode', (hot await hotswapMockSdkProvider.tryHotswapDeployment(hotswapMode, cdkStackArtifact); // THEN - expect(waitUntilFunctionUpdated).toHaveBeenCalledWith( + expect(waitUntilFunctionUpdatedV2).toHaveBeenCalledWith( expect.objectContaining({ minDelay: 5, maxDelay: 5,