Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat(lambda): add NodeJS 22.x support #32104

Merged
merged 2 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,56 @@
"DependsOn": [
"NODEJS20XServiceRole188A4E38"
]
},
"NODEJS22XServiceRole8FE2F7A5": {
"Type": "AWS::IAM::Role",
"Properties": {
"AssumeRolePolicyDocument": {
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "lambda.amazonaws.com"
}
}
],
"Version": "2012-10-17"
},
"ManagedPolicyArns": [
{
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
]
]
}
]
}
},
"NODEJS22X911196A1": {
"Type": "AWS::Lambda::Function",
"Properties": {
"Code": {
"ZipFile": "exports.handler = async function(event) { return \"success\" }"
},
"Handler": "index.handler",
"Role": {
"Fn::GetAtt": [
"NODEJS22XServiceRole8FE2F7A5",
"Arn"
]
},
"Runtime": "nodejs22.x"
},
"DependsOn": [
"NODEJS22XServiceRole8FE2F7A5"
]
}
},
"Outputs": {
Expand Down Expand Up @@ -386,6 +436,11 @@
"Value": {
"Ref": "NODEJS20X70A25ADE"
}
},
"NODEJS22XfunctionName": {
"Value": {
"Ref": "NODEJS22X911196A1"
}
}
},
"Parameters": {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ const node20xfn = new Function(stack, 'NODEJS_20_X', {
});
new CfnOutput(stack, 'NODEJS_20_X-functionName', { value: node20xfn.functionName });

const node22xfn = new Function(stack, 'NODEJS_22_X', {
Copy link
Contributor

Choose a reason for hiding this comment

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

later on we should add NodeJs function integ test cases to make sure that the build image is available

code: new InlineCode('exports.handler = async function(event) { return "success" }'),
handler: 'index.handler',
runtime: Runtime.NODEJS_22_X,
});
new CfnOutput(stack, 'NODEJS_22_X-functionName', { value: node22xfn.functionName });

new integ.IntegTest(app, 'lambda-runtime-inlinecode', {
testCases: [stack],
});
5 changes: 5 additions & 0 deletions packages/aws-cdk-lib/aws-lambda/lib/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ export class Runtime {
*/
public static readonly NODEJS_LATEST = new Runtime('nodejs18.x', RuntimeFamily.NODEJS, { supportsInlineCode: true, isVariable: true });

/**
* The NodeJS 22.x runtime (nodejs22.x)
*/
public static readonly NODEJS_22_X = new Runtime('nodejs22.x', RuntimeFamily.NODEJS, { supportsInlineCode: true });

/**
* The Python 2.7 runtime (python2.7)
* @deprecated Legacy runtime no longer supported by AWS Lambda. Migrate to the latest Python runtime.
Expand Down