Skip to content

Commit 640821d

Browse files
authored
feat(stepfunctions-tasks): add Node.js 22 support to EvaluateExpression (aws#35370)
### Issue # (if applicable) Closes aws#35353. ### Reason for this change Currently you are unable to specify the NodeJS 22 Runtime directly in the EvaluateExpression construct. When users try to use `Runtime.NODEJS_22_X`, they receive an error that this runtime is not supported. ### Description of changes - Added Node.js 22 runtime mapping to the `nodeJsGuids` object in `evaluate-expression.ts` with UUID `'b64e1fb8-9c89-4f7d-8a34-2e2a1c5f6d7e'` - Added unit test coverage for Node.js 22 runtime in `evaluate-expression.test.ts` The changes follow the exact same pattern as existing Node.js runtime support (Node.js 20, 18, etc.). No alternatives were considered as this is a straightforward addition to the existing runtime mapping system. The UUID was generated to ensure uniqueness for the singleton Lambda function pattern used by EvaluateExpression. ### Describe any new or updated permissions being added No new or updated IAM permissions are required. This change only adds support for an additional Lambda runtime version. ### Description of how you validated changes - Added unit test that verifies EvaluateExpression creates a Lambda function with `nodejs22.x` runtime - All existing tests continue to pass (5/5 tests passing) - Manually tested by creating a CDK app, synthesizing CloudFormation template, and deploying to AWS - Verified the deployed Lambda function uses Node.js 22 runtime and executes successfully and returns ### 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*
1 parent adb44f4 commit 640821d

File tree

12 files changed

+1137
-0
lines changed

12 files changed

+1137
-0
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.evaluate-expression-nodejs22.js.snapshot/EvaluateExpressionNodejs22DefaultTestDeployAssert27FE8CA6.assets.json

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.evaluate-expression-nodejs22.js.snapshot/EvaluateExpressionNodejs22DefaultTestDeployAssert27FE8CA6.template.json

Lines changed: 36 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.evaluate-expression-nodejs22.js.snapshot/asset.b8cec122f25692e8b194663d25a2ee5e0b65e55df966120791d6a3ddc08fc136/index.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.evaluate-expression-nodejs22.js.snapshot/cdk.out

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.evaluate-expression-nodejs22.js.snapshot/evaluate-expression-nodejs22.assets.json

Lines changed: 34 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
{
2+
"Resources": {
3+
"Evalb64e1fb89c894f7d8a342e2a1c5f6d7eServiceRole544E6136": {
4+
"Type": "AWS::IAM::Role",
5+
"Properties": {
6+
"AssumeRolePolicyDocument": {
7+
"Statement": [
8+
{
9+
"Action": "sts:AssumeRole",
10+
"Effect": "Allow",
11+
"Principal": {
12+
"Service": "lambda.amazonaws.com"
13+
}
14+
}
15+
],
16+
"Version": "2012-10-17"
17+
},
18+
"ManagedPolicyArns": [
19+
{
20+
"Fn::Join": [
21+
"",
22+
[
23+
"arn:",
24+
{
25+
"Ref": "AWS::Partition"
26+
},
27+
":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
28+
]
29+
]
30+
}
31+
]
32+
}
33+
},
34+
"Evalb64e1fb89c894f7d8a342e2a1c5f6d7e3682A325": {
35+
"Type": "AWS::Lambda::Function",
36+
"Properties": {
37+
"Code": {
38+
"S3Bucket": {
39+
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
40+
},
41+
"S3Key": "b8cec122f25692e8b194663d25a2ee5e0b65e55df966120791d6a3ddc08fc136.zip"
42+
},
43+
"Handler": "index.handler",
44+
"Role": {
45+
"Fn::GetAtt": [
46+
"Evalb64e1fb89c894f7d8a342e2a1c5f6d7eServiceRole544E6136",
47+
"Arn"
48+
]
49+
},
50+
"Runtime": "nodejs22.x"
51+
},
52+
"DependsOn": [
53+
"Evalb64e1fb89c894f7d8a342e2a1c5f6d7eServiceRole544E6136"
54+
]
55+
},
56+
"Evalb64e1fb89c894f7d8a342e2a1c5f6d7eLogGroup529D8984": {
57+
"Type": "AWS::Logs::LogGroup",
58+
"Properties": {
59+
"LogGroupName": {
60+
"Fn::Join": [
61+
"",
62+
[
63+
"/aws/lambda/",
64+
{
65+
"Ref": "Evalb64e1fb89c894f7d8a342e2a1c5f6d7e3682A325"
66+
}
67+
]
68+
]
69+
},
70+
"RetentionInDays": 731
71+
},
72+
"UpdateReplacePolicy": "Retain",
73+
"DeletionPolicy": "Retain"
74+
},
75+
"StateMachineRoleB840431D": {
76+
"Type": "AWS::IAM::Role",
77+
"Properties": {
78+
"AssumeRolePolicyDocument": {
79+
"Statement": [
80+
{
81+
"Action": "sts:AssumeRole",
82+
"Effect": "Allow",
83+
"Principal": {
84+
"Service": "states.amazonaws.com"
85+
}
86+
}
87+
],
88+
"Version": "2012-10-17"
89+
}
90+
}
91+
},
92+
"StateMachineRoleDefaultPolicyDF1E6607": {
93+
"Type": "AWS::IAM::Policy",
94+
"Properties": {
95+
"PolicyDocument": {
96+
"Statement": [
97+
{
98+
"Action": "lambda:InvokeFunction",
99+
"Effect": "Allow",
100+
"Resource": [
101+
{
102+
"Fn::GetAtt": [
103+
"Evalb64e1fb89c894f7d8a342e2a1c5f6d7e3682A325",
104+
"Arn"
105+
]
106+
},
107+
{
108+
"Fn::Join": [
109+
"",
110+
[
111+
{
112+
"Fn::GetAtt": [
113+
"Evalb64e1fb89c894f7d8a342e2a1c5f6d7e3682A325",
114+
"Arn"
115+
]
116+
},
117+
":*"
118+
]
119+
]
120+
}
121+
]
122+
}
123+
],
124+
"Version": "2012-10-17"
125+
},
126+
"PolicyName": "StateMachineRoleDefaultPolicyDF1E6607",
127+
"Roles": [
128+
{
129+
"Ref": "StateMachineRoleB840431D"
130+
}
131+
]
132+
}
133+
},
134+
"StateMachine2E01A3A5": {
135+
"Type": "AWS::StepFunctions::StateMachine",
136+
"Properties": {
137+
"DefinitionString": {
138+
"Fn::Join": [
139+
"",
140+
[
141+
"{\"StartAt\":\"Task\",\"States\":{\"Task\":{\"End\":true,\"Type\":\"Task\",\"Resource\":\"",
142+
{
143+
"Fn::GetAtt": [
144+
"Evalb64e1fb89c894f7d8a342e2a1c5f6d7e3682A325",
145+
"Arn"
146+
]
147+
},
148+
"\",\"Parameters\":{\"expression\":\"$.a + $.b\",\"expressionAttributeValues\":{\"$.a.$\":\"$.a\",\"$.b.$\":\"$.b\"}}}}}"
149+
]
150+
]
151+
},
152+
"RoleArn": {
153+
"Fn::GetAtt": [
154+
"StateMachineRoleB840431D",
155+
"Arn"
156+
]
157+
}
158+
},
159+
"DependsOn": [
160+
"StateMachineRoleDefaultPolicyDF1E6607",
161+
"StateMachineRoleB840431D"
162+
],
163+
"UpdateReplacePolicy": "Delete",
164+
"DeletionPolicy": "Delete"
165+
}
166+
},
167+
"Parameters": {
168+
"BootstrapVersion": {
169+
"Type": "AWS::SSM::Parameter::Value<String>",
170+
"Default": "/cdk-bootstrap/hnb659fds/version",
171+
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]"
172+
}
173+
},
174+
"Rules": {
175+
"CheckBootstrapVersion": {
176+
"Assertions": [
177+
{
178+
"Assert": {
179+
"Fn::Not": [
180+
{
181+
"Fn::Contains": [
182+
[
183+
"1",
184+
"2",
185+
"3",
186+
"4",
187+
"5"
188+
],
189+
{
190+
"Ref": "BootstrapVersion"
191+
}
192+
]
193+
}
194+
]
195+
},
196+
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI."
197+
}
198+
]
199+
}
200+
}
201+
}

packages/@aws-cdk-testing/framework-integ/test/aws-stepfunctions-tasks/test/integ.evaluate-expression-nodejs22.js.snapshot/integ.json

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)