Skip to content

Commit 04b30f3

Browse files
authored
fix(lambda): update default runtimes and tests to node 18 (#27066)
Upgrades remaining runtime versions from `NODEJS_16_X` (which enters EOL on 2023-09-11 and will enter Lambda's Deprecation Phase 1 on Mar 11 2024) to NODEJS_18_X. Also updates remaining unit & integration tests to use NODEJS_LATEST or NODEJS_18_X. Most tests will reference the lambda runtime version via a new centralized configuration. Updated a number of test handlers to use SDKv3 and cleaned-up some duplicated, unused handler files. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 5046a9b commit 04b30f3

File tree

604 files changed

+172417
-165891
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

604 files changed

+172417
-165891
lines changed

Diff for: packages/@aws-cdk-testing/cli-integ/resources/cdk-apps/app/app.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ class BundlingStage extends cdk.Stage {
351351
new lambda.Function(stack, 'Handler', {
352352
code: lambda.Code.fromAsset(path.join(__dirname, 'lambda')),
353353
handler: 'index.handler',
354-
runtime: lambda.Runtime.NODEJS_16_X,
354+
runtime: lambda.Runtime.NODEJS_LATEST,
355355
});
356356
}
357357
}

Diff for: packages/@aws-cdk-testing/framework-integ/package.json

+3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
"@aws-cdk/cdk-build-tools": "0.0.0",
3333
"@aws-cdk/integ-runner": "^0.0.0",
3434
"@aws-cdk/pkglint": "0.0.0",
35+
"@aws-sdk/client-acm": "3.408.0",
36+
"@aws-sdk/client-rds": "3.408.0",
37+
"@aws-sdk/client-s3": "3.408.0",
3538
"delay": "5.0.0"
3639
},
3740
"dependencies": {

Diff for: packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.request-authorizer.lit.js.snapshot/RequestAuthorizerInteg.assets.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414
}
1515
}
1616
},
17-
"2e7d8bf0e8057cc8d78fd4928137f285242b175a548bbcf501299a118037c8d1": {
17+
"4f386f4c2e0c9ab2438dbd353ec9ab0ccb080c2c9ad43ff62d01838ab904a016": {
1818
"source": {
1919
"path": "RequestAuthorizerInteg.template.json",
2020
"packaging": "file"
2121
},
2222
"destinations": {
2323
"current_account-current_region": {
2424
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
25-
"objectKey": "2e7d8bf0e8057cc8d78fd4928137f285242b175a548bbcf501299a118037c8d1.json",
25+
"objectKey": "4f386f4c2e0c9ab2438dbd353ec9ab0ccb080c2c9ad43ff62d01838ab904a016.json",
2626
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
2727
}
2828
}

Diff for: packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.request-authorizer.lit.js.snapshot/RequestAuthorizerInteg.template.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"Arn"
4848
]
4949
},
50-
"Runtime": "nodejs16.x"
50+
"Runtime": "nodejs18.x"
5151
},
5252
"DependsOn": [
5353
"MyAuthorizerFunctionServiceRole8A34C19E"

Diff for: packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.request-authorizer.lit.js.snapshot/manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"validateOnSynth": false,
1818
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}",
1919
"cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}",
20-
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/2e7d8bf0e8057cc8d78fd4928137f285242b175a548bbcf501299a118037c8d1.json",
20+
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/4f386f4c2e0c9ab2438dbd353ec9ab0ccb080c2c9ad43ff62d01838ab904a016.json",
2121
"requiresBootstrapStackVersion": 6,
2222
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
2323
"additionalDependencies": [

Diff for: packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.request-authorizer.lit.js.snapshot/tree.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
"Arn"
115115
]
116116
},
117-
"runtime": "nodejs16.x"
117+
"runtime": "nodejs18.x"
118118
}
119119
},
120120
"constructInfo": {
@@ -720,7 +720,7 @@
720720
"path": "Tree",
721721
"constructInfo": {
722722
"fqn": "constructs.Construct",
723-
"version": "10.2.69"
723+
"version": "10.2.70"
724724
}
725725
}
726726
},

Diff for: packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.request-authorizer.lit.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import * as path from 'path';
22
import * as lambda from 'aws-cdk-lib/aws-lambda';
33
import { App, Stack } from 'aws-cdk-lib';
44
import { MockIntegration, PassthroughBehavior, RestApi, RequestAuthorizer, IdentitySource } from 'aws-cdk-lib/aws-apigateway';
5+
import { STANDARD_NODEJS_RUNTIME } from '../../../config';
56

67
// Against the RestApi endpoint from the stack output, run
78
// `curl -s -o /dev/null -w "%{http_code}" <url>` should return 401
@@ -12,7 +13,7 @@ const app = new App();
1213
const stack = new Stack(app, 'RequestAuthorizerInteg');
1314

1415
const authorizerFn = new lambda.Function(stack, 'MyAuthorizerFunction', {
15-
runtime: lambda.Runtime.NODEJS_16_X,
16+
runtime: STANDARD_NODEJS_RUNTIME,
1617
handler: 'index.handler',
1718
code: lambda.AssetCode.fromAsset(path.join(__dirname, 'integ.request-authorizer.handler')),
1819
});

Diff for: packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.js.snapshot/TokenAuthorizerIAMRoleInteg.assets.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414
}
1515
}
1616
},
17-
"fb708804d80325ef7f30899c91423ae60ebe0a8833e8777df39537565bb69b0b": {
17+
"1700f94824f0c5de41fa729800151d6296945b6e5fa1536c384e04b7a1377f4c": {
1818
"source": {
1919
"path": "TokenAuthorizerIAMRoleInteg.template.json",
2020
"packaging": "file"
2121
},
2222
"destinations": {
2323
"current_account-current_region": {
2424
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
25-
"objectKey": "fb708804d80325ef7f30899c91423ae60ebe0a8833e8777df39537565bb69b0b.json",
25+
"objectKey": "1700f94824f0c5de41fa729800151d6296945b6e5fa1536c384e04b7a1377f4c.json",
2626
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
2727
}
2828
}

Diff for: packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.js.snapshot/TokenAuthorizerIAMRoleInteg.template.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"Arn"
4848
]
4949
},
50-
"Runtime": "nodejs16.x"
50+
"Runtime": "nodejs18.x"
5151
},
5252
"DependsOn": [
5353
"MyAuthorizerFunctionServiceRole8A34C19E"

Diff for: packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.js.snapshot/manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"validateOnSynth": false,
1818
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}",
1919
"cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}",
20-
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/fb708804d80325ef7f30899c91423ae60ebe0a8833e8777df39537565bb69b0b.json",
20+
"stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/1700f94824f0c5de41fa729800151d6296945b6e5fa1536c384e04b7a1377f4c.json",
2121
"requiresBootstrapStackVersion": 6,
2222
"bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version",
2323
"additionalDependencies": [

Diff for: packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.js.snapshot/tree.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
"Arn"
115115
]
116116
},
117-
"runtime": "nodejs16.x"
117+
"runtime": "nodejs18.x"
118118
}
119119
},
120120
"constructInfo": {
@@ -579,7 +579,7 @@
579579
"path": "iam-token-authorizer/DefaultTest/Default",
580580
"constructInfo": {
581581
"fqn": "constructs.Construct",
582-
"version": "10.2.69"
582+
"version": "10.2.70"
583583
}
584584
},
585585
"DeployAssert": {
@@ -625,7 +625,7 @@
625625
"path": "Tree",
626626
"constructInfo": {
627627
"fqn": "constructs.Construct",
628-
"version": "10.2.69"
628+
"version": "10.2.70"
629629
}
630630
}
631631
},

Diff for: packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer-iam-role.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import * as lambda from 'aws-cdk-lib/aws-lambda';
44
import { App, Stack } from 'aws-cdk-lib';
55
import { IntegTest } from '@aws-cdk/integ-tests-alpha';
66
import { AuthorizationType, MockIntegration, PassthroughBehavior, RestApi, TokenAuthorizer } from 'aws-cdk-lib/aws-apigateway';
7+
import { STANDARD_NODEJS_RUNTIME } from '../../../config';
78

89
/*
910
* Stack verification steps:
@@ -16,7 +17,7 @@ const app = new App();
1617
const stack = new Stack(app, 'TokenAuthorizerIAMRoleInteg');
1718

1819
const authorizerFn = new lambda.Function(stack, 'MyAuthorizerFunction', {
19-
runtime: lambda.Runtime.NODEJS_16_X,
20+
runtime: STANDARD_NODEJS_RUNTIME,
2021
handler: 'index.handler',
2122
code: lambda.AssetCode.fromAsset(path.join(__dirname, 'integ.token-authorizer.handler')),
2223
});

Diff for: packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/TokenAuthorizerInteg.assets.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414
}
1515
}
1616
},
17-
"568e7d470f7811087df1c347caee3ce932a45d3bceb2274d3f0376ac5a8b8f72": {
17+
"ade8b2061e29b24d8acb0dbb8d8e63847fd6feefbe140e87eb7d76ea0cee27cf": {
1818
"source": {
1919
"path": "TokenAuthorizerInteg.template.json",
2020
"packaging": "file"
2121
},
2222
"destinations": {
2323
"current_account-current_region": {
2424
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
25-
"objectKey": "568e7d470f7811087df1c347caee3ce932a45d3bceb2274d3f0376ac5a8b8f72.json",
25+
"objectKey": "ade8b2061e29b24d8acb0dbb8d8e63847fd6feefbe140e87eb7d76ea0cee27cf.json",
2626
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
2727
}
2828
}

Diff for: packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/TokenAuthorizerInteg.template.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"Arn"
4848
]
4949
},
50-
"Runtime": "nodejs16.x"
50+
"Runtime": "nodejs18.x"
5151
},
5252
"DependsOn": [
5353
"MyAuthorizerFunctionServiceRole8A34C19E"
@@ -384,7 +384,7 @@
384384
"Arn"
385385
]
386386
},
387-
"Runtime": "nodejs16.x",
387+
"Runtime": "nodejs18.x",
388388
"Timeout": 10
389389
},
390390
"DependsOn": [

Diff for: packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/apigwtokenauthDefaultTestDeployAssert2CF60E05.assets.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
{
22
"version": "34.0.0",
33
"files": {
4-
"d69f83e949b9c49809604e7bcd3a868d44f04f936029b55662aa14982d9bd44b": {
4+
"77997674c0a10fbb65169124ad6c0d7a664b6162ad44f9abfa22fd006b33f754": {
55
"source": {
6-
"path": "asset.d69f83e949b9c49809604e7bcd3a868d44f04f936029b55662aa14982d9bd44b.bundle",
6+
"path": "asset.77997674c0a10fbb65169124ad6c0d7a664b6162ad44f9abfa22fd006b33f754.bundle",
77
"packaging": "zip"
88
},
99
"destinations": {
1010
"current_account-current_region": {
1111
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
12-
"objectKey": "d69f83e949b9c49809604e7bcd3a868d44f04f936029b55662aa14982d9bd44b.zip",
12+
"objectKey": "77997674c0a10fbb65169124ad6c0d7a664b6162ad44f9abfa22fd006b33f754.zip",
1313
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
1414
}
1515
}
1616
},
17-
"32a3aac734a72e886e3c709c16dcc1dd16078db65460a952f17fbdba721411af": {
17+
"92ac4cd48fe3ed9dff2af30d131aa768b19a417e4dab50160b7448d58e219528": {
1818
"source": {
1919
"path": "apigwtokenauthDefaultTestDeployAssert2CF60E05.template.json",
2020
"packaging": "file"
2121
},
2222
"destinations": {
2323
"current_account-current_region": {
2424
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
25-
"objectKey": "32a3aac734a72e886e3c709c16dcc1dd16078db65460a952f17fbdba721411af.json",
25+
"objectKey": "92ac4cd48fe3ed9dff2af30d131aa768b19a417e4dab50160b7448d58e219528.json",
2626
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
2727
}
2828
}

Diff for: packages/@aws-cdk-testing/framework-integ/test/aws-apigateway/test/authorizers/integ.token-authorizer.js.snapshot/apigwtokenauthDefaultTestDeployAssert2CF60E05.template.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"Payload": "\"{\\\"method\\\":\\\"GET\\\",\\\"authorization\\\":\\\"allow\\\"}\""
2929
},
3030
"flattenResponse": "false",
31-
"salt": "1693324935277"
31+
"salt": "1694443541803"
3232
},
3333
"UpdateReplacePolicy": "Delete",
3434
"DeletionPolicy": "Delete"
@@ -208,7 +208,7 @@
208208
"S3Bucket": {
209209
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
210210
},
211-
"S3Key": "d69f83e949b9c49809604e7bcd3a868d44f04f936029b55662aa14982d9bd44b.zip"
211+
"S3Key": "77997674c0a10fbb65169124ad6c0d7a664b6162ad44f9abfa22fd006b33f754.zip"
212212
},
213213
"Timeout": 120,
214214
"Handler": "index.handler",
@@ -248,7 +248,7 @@
248248
"Payload": "\"{\\\"method\\\":\\\"GET\\\",\\\"authorization\\\":\\\"deny\\\"}\""
249249
},
250250
"flattenResponse": "false",
251-
"salt": "1693324935278"
251+
"salt": "1694443541805"
252252
},
253253
"UpdateReplacePolicy": "Delete",
254254
"DeletionPolicy": "Delete"
@@ -296,7 +296,7 @@
296296
"Payload": "\"{\\\"method\\\":\\\"OPTIONS\\\"}\""
297297
},
298298
"flattenResponse": "false",
299-
"salt": "1693324935278"
299+
"salt": "1694443541806"
300300
},
301301
"UpdateReplacePolicy": "Delete",
302302
"DeletionPolicy": "Delete"
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
"use strict";
12
var __create = Object.create;
23
var __defProp = Object.defineProperty;
34
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -32329,6 +32330,7 @@ var CustomResourceHandler = class {
3232932330
constructor(event, context) {
3233032331
this.event = event;
3233132332
this.context = context;
32333+
this.timedOut = false;
3233232334
this.timeout = setTimeout(async () => {
3233332335
await this.respond({
3233432336
status: "FAILED",
@@ -32340,9 +32342,6 @@ var CustomResourceHandler = class {
3234032342
this.event = event;
3234132343
this.physicalResourceId = extractPhysicalResourceId(event);
3234232344
}
32343-
physicalResourceId;
32344-
timeout;
32345-
timedOut = false;
3234632345
/**
3234732346
* Handles executing the custom resource event. If `stateMachineArn` is present
3234832347
* in the props then trigger the waiter statemachine
@@ -32476,7 +32475,6 @@ var AssertionHandler = class extends CustomResourceHandler {
3247632475
}
3247732476
};
3247832477
var MatchCreator = class {
32479-
parsedObj;
3248032478
constructor(obj) {
3248132479
this.parsedObj = {
3248232480
matcher: obj
@@ -32685,7 +32683,8 @@ var AwsApiCallHandler = class extends CustomResourceHandler {
3268532683
const sdkPkg = getServicePackage(request2.service);
3268632684
const client = getServiceClient(sdkPkg);
3268732685
const Command = getSdkCommand(sdkPkg, request2.api);
32688-
const commandInput = (request2.parameters && decodeParameters(request2.parameters)) ?? {};
32686+
const parameters = (request2.parameters && decodeParameters(request2.parameters)) ?? {};
32687+
const commandInput = (0, import_sdk_v2_to_v3_adapter.coerceApiParametersToUint8Array)(request2.service, request2.api, parameters);
3268932688
console.log(`SDK request to ${sdkPkg.service}.${request2.api} with parameters ${JSON.stringify(commandInput)}`);
3269032689
const response = await client.send(new Command(commandInput));
3269132690
if (response.Payload) {

0 commit comments

Comments
 (0)