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

(lambda): Deployment fails due to deprecated nodejs14.x runtime used in retention Lambdas #29312

Closed
jgarbers opened this issue Feb 29, 2024 · 3 comments
Labels
@aws-cdk/aws-lambda Related to AWS Lambda bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.

Comments

@jgarbers
Copy link

Describe the bug

Deploying a previously-working Python-based stack (cdk cli v2.130.0, aws-cdk.core package 1.204.0) fails with this error:

11:09:58 AM | CREATE_FAILED        | AWS::Lambda::Function       | Custom::S3AutoDele...ceProvider/Handler
Resource handler returned message: "The runtime parameter of nodejs14.x is no longer supported for creating or updating AWS Lambda functions. We recommend you use the new runtime (nodejs20.x) while creating or updating fun
ctions. (Service: Lambda, Status Code: 400, Request ID: f564c073-8071-45b0-a42e-cadae0894a78)" (RequestToken: 313b1028-5a92-5ee9-0639-543bd8462254, HandlerErrorCode: InvalidRequest)

My stack does not include any NodeJS-based Lambdas, but the error seems to be coming from the creation of a Lambda function that manages log retention. My code sets a retention policy of "ONE_YEAR" on the logs generated by my own Python-based lambdas, but the selection of the now-deprecated nodejs14.x runtime for the log retention functions seems to be something built into the CDK templates.

Expected Behavior

Stack should have deployed successfully, using a non-deprecated runtime for Lambdas created outside the control of my own CDK code.

Current Behavior

Deployment fails and rolls back with this error:

11:09:58 AM | CREATE_FAILED | AWS::Lambda::Function | CustomS3AutoDelete...derHandler9D90184F
Resource handler returned message: "The runtime parameter of nodejs14.x is no longer supported for creating or updating AWS Lambda functions. We recommend you use the new runtime (nodejs20.x) while creating or updating fun
ctions. (Service: Lambda, Status Code: 400, Request ID: f564c073-8071-45b0-a42e-cadae0894a78)" (RequestToken: 313b1028-5a92-5ee9-0639-543bd8462254, HandlerErrorCode: InvalidRequest)

new CustomResourceProvider (/var/folders/hq/pgch1ncd5cg2l7xdwcbmfclh0000gq/T/jsii-kernel-8KmuyN/node_modules/@aws-cdk/core/lib/custom-resource-provider/custom-resource-provider.js:122:25)
\_ CustomResourceProvider.getOrCreateProvider (/var/folders/hq/pgch1ncd5cg2l7xdwcbmfclh0000gq/T/jsii-kernel-8KmuyN/node_modules/@aws-cdk/core/lib/custom-resource-provider/custom-resource-provider.js:194:16)
\_ Bucket.enableAutoDeleteObjects (/var/folders/hq/pgch1ncd5cg2l7xdwcbmfclh0000gq/T/jsii-kernel-8KmuyN/node_modules/@aws-cdk/aws-s3/lib/bucket.js:1199:56)
\_ new Bucket (/var/folders/hq/pgch1ncd5cg2l7xdwcbmfclh0000gq/T/jsii-kernel-8KmuyN/node_modules/@aws-cdk/aws-s3/lib/bucket.js:724:18)
\_ Kernel._Kernel_create (/private/var/folders/hq/pgch1ncd5cg2l7xdwcbmfclh0000gq/T/tmpfxb7n59q/lib/program.js:10108:25)
\_ Kernel.create (/private/var/folders/hq/pgch1ncd5cg2l7xdwcbmfclh0000gq/T/tmpfxb7n59q/lib/program.js:9779:93)
\_ KernelHost.processRequest (/private/var/folders/hq/pgch1ncd5cg2l7xdwcbmfclh0000gq/T/tmpfxb7n59q/lib/program.js:11696:36)
\_ KernelHost.run (/private/var/folders/hq/pgch1ncd5cg2l7xdwcbmfclh0000gq/T/tmpfxb7n59q/lib/program.js:11656:22)
\_ Immediate._onImmediate (/private/var/folders/hq/pgch1ncd5cg2l7xdwcbmfclh0000gq/T/tmpfxb7n59q/lib/program.js:11657:46)
\_ process.processImmediate (node:internal/timers:478:21)

Reproduction Steps

I'd think any stack that includes a log retention policy would run into this problem; will try to provide minimal example shortly.

Possible Solution

Specify nodejs20.x in built-in templates that generate Lambdas.

Additional Information/Context

No response

CDK CLI Version

2.130.0

Framework Version

No response

Node.js Version

20.5.1

OS

macOS 13.5.1

Language

Python

Language Version

Python (3.11.5)

Other information

No response

@jgarbers jgarbers added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Feb 29, 2024
@github-actions github-actions bot added the @aws-cdk/aws-lambda Related to AWS Lambda label Feb 29, 2024
@jgarbers
Copy link
Author

Freshly-created Python CDK project uses nodejs18.x for its retention Lambda, which works. Guessing that I have old versions of packages and/or templates in my main project; will investigate.

@jgarbers
Copy link
Author

Upgrading to aws-cdk-lib 2.130.0 has eliminated the problem -- needed to remove existing CDK dependencie, install aws-cdk-lib and constructs packages, and make minor changes to stack code. Sorry for the false alarm; I'll close the issue and defer to maintainers whether to delete it as unnecessary or retain in case someone else runs into a similar problem.

Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-lambda Related to AWS Lambda bug This issue is a bug. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

No branches or pull requests

1 participant