Update node version of the -custom-resource-apigw-cw-role

Hi,

Node version 16.X will be deprecated soon, and I need to upgrade my lambdas (-custom-resource-apigw-cw-role) to node 18.X or higher, how can I do it?

Do you see a runtime: under either provider or each of the functions? It probably says runtime: nodejs16.x. Change that to runtime: nodejs18.x

My functions are running in dotnet6.

In my serveless.yml file I don’t have nodejs reference directly

Are you using any custom plugins?

Yes, I’m using a serverless plugin, but the *-custom-resource-apigw-cw-role isn’t created by serverless framework in REST API functions?

There’s a good chance that plugin is creating the Lambda that’s causing the problem. Potentially the easiest solution is just to update the plugin version and deploy again. You can be certain by looking through the Lambda console to find the Lambda function that is causing the problem then use the CloudFormation console to determine how it’s being deployed.

To my understanding, these resources are created by the Serverless framework, when you enable API Gateway logs. This is not a plugin, but part of core Serverless framework. Since these resources are done by the framework, we as framework users don’t have any ability to set the runtime used (e.g. my project is all Go code, I don’t use JS at all, but these resources are created behind the scenes with JS by Serverless). This is problematic, as everyone is now seeing in that AWS is deprecating these older Node versions, but this code and the runtime it uses doesn’t seem to be getting updated along with updates to the Serverless framework. Since this is somewhat of a black box, it’s not clear how safe it is for us to just go into the AWS console and change the runtime (i.e. from 16 to 20, which is now the current recommended).

1 Like

I’m also trying to upgrade nodejs16 lambdas and got the same issue. Is there any pernament solution?

this is the solution Use nodejs18 in custom-resources by svoychik · Pull Request #12146 · serverless/serverless · GitHub … but needs some love from Serverless Inc to get it merged …