Skip to content

Conversation

@AlesioSinopoli
Copy link

Problem

AWS will deprecate the nodejs18.x runtime starting April 30, 2025. It has already starting notifying account about this change:

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

We are ending support for Node.js 18 in Lambda on September 1, 2025. This follows Node.js 18 End-Of-Life (EOL) reached on April 30, 2025 [1]. End of support does not impact function execution. Your functions will continue to run. However, they will be running on an unsupported runtime which is no longer maintained or patched by the AWS Lambda team.

When using the serverless framework to deploy a project, a "custom-resource-apigw-cw-role" lambda gets created. The runtime of this lambda is hardcoded in lib/plugins/aws/custom-resources/index.js and it can't be changed or configured through the main serverless.yml configuration file (see serverless/serverless#12307 as a reference).

Solution

This PR updates all the hardcoded runtime versions to nodejs20.x in order to avoid the deprecation warning.


getRuntime(runtime) {
const defaultRuntime = 'nodejs18.x';
const defaultRuntime = 'nodejs20.x';
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a breaking change to the default.

Copy link
Author

Choose a reason for hiding this comment

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

I made a new commit to revert that change, but upon further inspection, line 166 of custom-resources/index.js (

const providerRuntime = awsProvider.getRuntime();
) calls AwsProvider.getRuntime in order to get the runtime version.

If I revert that change, then this PR is not that useful... we'll still get a deprecation warning related to the custom-resource-apigw-cw-role lambda.

Could you indicate why it is a breaking change? I have no problem looking into it and see if we can update it properly.

@GrahamCampbell
Copy link
Contributor

We should update the examples, but not change the default IMO.

Copy link
Contributor

@GrahamCampbell GrahamCampbell left a comment

Choose a reason for hiding this comment

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

Can you revert all the places where the default was changed please. I commented on just one, but there's at least one other.

}

let runtimeVersion = 'nodejs18.x';
let runtimeVersion = 'nodejs20.x';
Copy link
Contributor

Choose a reason for hiding this comment

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

revert


getRuntime(runtime) {
const defaultRuntime = 'nodejs18.x';
const defaultRuntime = 'nodejs20.x';
Copy link
Contributor

Choose a reason for hiding this comment

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

revert

@AlesioSinopoli
Copy link
Author

Can you revert all the places where the default was changed please. I commented on just one, but there's at least one other.

Please see the reply I left in your first comment.

If I revert the change in AwsProvider, then we won't solve the underlying problem about the runtime deprecation.

@GrahamCampbell
Copy link
Contributor

The deprecation message is not an error, it's just a deprecation. We have plenty of time before we need to actually stop using v18. I'd probably prefer we actually skipped v20, going straight for v22, so we only change the default every 2 years.

@AlesioSinopoli
Copy link
Author

The deprecation message is not an error, it's just a deprecation. We have plenty of time before we need to actually stop using v18. I'd probably prefer we actually skipped v20, going straight for v22, so we only change the default every 2 years.

That makes sense to me.

Is the jump to v22 as easy as just replacing the default runtime, or it's more complicated than that?

@GrahamCampbell
Copy link
Contributor

Yes. v20 and v22 are similar to upgrade to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants