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

Node.js version 12 reached End of Life (EOL) on April 30, 2022. Netlify Functions will stop supporting serverless function deploys using Node.js 12 on March 31, 2023.

Who is impacted?

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

If you keep the environment variable set to nodejs12.x and deploy any changes to your existing functions on or after March 31, 2023, 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 nodejs14.x, nodejs16.x or nodejs18.x
  • Remove the AWS_LAMBDA_JS_RUNTIME environment variable altogether, in which case we will default to using nodejs16.x

Test your functions on a new runtime

For many functions, upgrading from Node 12 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:

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.