aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.61k stars 3.9k forks source link

(custom-resources): use lambda.Runtime.NODEJS_14_X by default in Provider #19117

Closed pkwarren closed 2 years ago

pkwarren commented 2 years ago

Description

Similar to #13225, we should update to latest supported Node.js runtime for the custom-resources lambda prior to Node 12 going out of service.

https://github.com/aws/aws-cdk/blob/4e82d362fa1fa90de20f07d3a11f368ece4ab957/packages/%40aws-cdk/custom-resources/lib/provider-framework/provider.ts#L214

Use Case

All lambdas created by aws-cdk internally should be updated prior to EOL.

Proposed Solution

Update to NODEJS_14_X when creating lambda in custom-resources.

Other information

No response

Acknowledge

rix0rrr commented 2 years ago

Can you share or link the communication you've gotten from Lambda? I can't seem to find any easily.

pkwarren commented 2 years ago

We've not gotten communication from AWS Lambda yet but we're in the process of updating all of our existing CDK projects because of Node 10.x no longer being supported: https://docs.aws.amazon.com/lambda/latest/dg/runtime-support-policy.html

Since Node 12.x is no longer receiving security updates this spring (https://nodejs.org/en/about/releases/) it felt like a good preventative change to keep ahead of these and use the latest supported Node runtime.

JeeZeh commented 2 years ago

We've not gotten communication from AWS Lambda yet

This week we've received the following guidance from AWS. We have a few custom resources defined in our accounts, which specify non-Node Lambda event handlers, but it seems the CustomResource Provider sets up a NodeJS 12 Lambda itself (description: AWS CDK resource provider framework).

I'm assuming this issue, once resolved, will upgrade the runtime of these providers.

Thanks, Jesse


Hello,

We are contacting you as we have identified that your AWS Account currently has one or more Lambda functions using Node.js 12 runtime.

We are ending support for Node.js 12 in AWS Lambda. This follows Node.js 12 End-Of-Life (EOL) reached on April 30, 2022 [1].

As described in the Lambda runtime support policy [2], end of support for language runtimes in Lambda happens in two stages. Starting November 14, 2022, Lambda will no longer apply security patches and other updates to the Node.js 12 runtime used by Lambda functions, and functions using Node.js 12 will no longer be eligible for technical support. In addition, you will no longer be able to create new Lambda functions using the Node.js 12 runtime. Starting December 14, 2022, you will no longer be able to update existing functions using the Node.js 12 runtime.

We recommend that you upgrade your existing Node.js 12 functions to Node.js 16 before November 14, 2022.

TakahiroImanishi commented 2 years ago

Hi.

I think this problem is solved by #20297 . I also checked the implementation.

https://github.com/aws/aws-cdk/issues/20297

JeeZeh commented 2 years ago

Hi.

I think this problem is solved by #20297 . I also checked the implementation.

https://github.com/aws/aws-cdk/issues/20297

Unless I misunderstand, this only resolves the issue for a Route 53 construct which uses custom resources right? The proposed change here is to set it as the default runtime for the custom resource framework itself.

TakahiroImanishi commented 2 years ago

Thank you. I understand #20297 is for a Route53 constrcut.

But,I read a source code, the code is fixed now.

https://github.com/aws/aws-cdk/blob/b8708e9ad476d12d0654ce34ae296f9c737c804d/packages/%40aws-cdk/custom-resources/lib/provider-framework/provider.ts#L210

TakahiroImanishi commented 2 years ago

Sorry, I may be misunderstanding the FIX Issue. I don't read past issues. Whichever, I think it is fixes this issue now.

keisukekomeda commented 2 years ago

Provider-framework lambda functions which were created before the PR #20595 seem to remain Node.js 12.x, even if the stacks including custom resources are redeployed. It might be confusing for you and others.

If there's a way to update the existing provider-framework lambda function, it helps.

peterwoodworth commented 2 years ago

This has been fixed, live code shows node 14

github-actions[bot] commented 2 years ago

⚠️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.

vibshukl commented 1 week ago

Could this be updated again to version 18? Node 14 is not supported in lambda.