End of support for Node.js 16 in Netlify Functions: Everything you need to know

Node.js version 16 reached End of Life (EOL) on September 11, 2023. Netlify Functions will stop supporting serverless function deploys using Node.js 16 on April 25, 2024.

Who is impacted?

You will be impacted if you have explicitly set the AWS_LAMBDA_JS_RUNTIME environment variable to nodejs16.x.

If you keep the environment variable set to nodejs16.x and deploy any changes to your existing functions on or after April 25, 2024, your build will fail.

If you do not deploy any changes to your functions, they will continue to run; end of support does not impact function execution. However, they will be running on an unsupported runtime that is no longer maintained or patched.

How to upgrade

You can upgrade your Node runtime and avoid build failures in two ways:

  • Set AWS_LAMBDA_JS_RUNTIME to nodejs20.x as it is a LTS version.
  • Remove the AWS_LAMBDA_JS_RUNTIME environment variable altogether, in which case we will default to using nodejs18.x

Test your functions on a new runtime

For many functions, upgrading from Node 16 will have no negative effects. For others, the upgraded version may cause bugs or other errors in your newly deployed functions. So it’s a good idea to test your functions first!

Changing the JavaScript functions runtime applies to all Netlify Functions on a site, in all deploys including production. This makes testing your functions in a new runtime a little trickier than the usual routine of making a PR and checking the Deploy Preview.

Here are a few methods you could use to test without risking errors in production:

  • Run your functions locally in the Netlify CLI using the netlify dev command. Whatever version of Node.js you’re running on your computer is the runtime your functions will use locally. You can use a tool like nvm or nvm-windows to manage multiple Node.js versions on your computer.

  • Test on Netlify by choosing a different Runtime via context-specific environment variables. You can leave AWS_LAMBDA_JS_RUNTIME set to nodejs16.x for production and set it to nodejs20.x for deploy previews, branches deployments or even specific branches. Then, trigger a deploy preview or branch deploy and test the functions in that deploy.

Updating your function code

So you’ve tested your functions in a newer runtime, and one of them doesn’t work!

It’s time to start checking error messages and debugging. The problem will often be caused by one or more dependencies, so a useful strategy is to update dependencies related to your error messages, update your functions code as needed to work with the newer version of the dependency, and test again.

Here are a few resources you may find helpful:

Also, always remember the Netlify Forum is here for you! You can ask questions or post additional tips and references in this topic, or start a new topic if it seems significantly different.

1 Like

Hi There… | have a .nvmrc file at 20.11.1 but I am still getting the warning at build time?

3:08:05 PM: Attempting Node.js version 'v20.11.1' from .nvmrc
3:08:06 PM: v20.11.1 is already installed.
3:08:06 PM: Now using node v20.11.1 (npm v10.2.4)

Hi Andy,

Do you have set the environment variable AWS_LAMBDA_JS_RUNTIME for your function with a different node version?

Also, you could try to re upload your function making a code change like a line comment or something like that to have a new upload with the latest runtime.

Hi biruwon… tried all of that. Still getting the warning. Obviously critical I fix this before tomorrow!

I have also set
NODE_ENV=production
NODE_VERSION=20.12.1
AWS_LAMBDA_JS_RUNTIME=20.12.1

.nvmrc to v20.12.1

Can you share a deploy ID where you are having that warning? Thanks!

[

West Warwickshire Sports Complex - Information Base
66295d224acf160008f3c974–wwsc-info.netlify.app

favicon-180.png

](https://66295d224acf160008f3c974--wwsc-info.netlify.app/)

Thanks Alex…. I hope this is enough for the deployment ID?

Regards, Andy

I can confirm you are using nodejs20 for your functions, so you won’t have any problems. We will review the build warning

Hello @biruwon!

Any update on removing the warning for projects that are using a .nvmrc with a version >16? It is quite confusing at the moment.

Not yet, but we have an issue for it and will try to resolve as soon as possible.