The default version of Node.js for Netlify Functions is being changed to be dynamic, based on the Node.js version that is used for your build. This change will take effect for any new deployments on or after the 15th of May 2023.
This means setting the environment variable
NODE_VERSION or using a
.nvmrc file in your project will also apply to Netlify Functions. Note that the Node.js version used for the build must meet the following conditions for the functions runtime to inherit it:
- is a valid runtime for Netlify Functions.
- is Node.js version 16 or newer. We do this so that sites do not get downgraded from the old static default.
Why are we doing this?
We are doing this to make it easier to keep the Node.js version used for your build and for Netlify Functions in sync. Certain frameworks and applications do require a specific Node.js version and this change will alleviate the need to configure this Node.js version in multiple locations and provide a better “works-out-of-the-box” experience.
What does this mean for my site?
AWS_LAMBDA_JS_RUNTIME set will continue to use that manually configured runtime version.
For sites using the old static default runtime version of Node.js 16
- If the build is using Node.js 18, the site will start using the Node.js 18 runtime for functions after a new deployment.
- If the build is using any other version of Node.js, the functions runtime will stay unchanged and continue to use the fallback default runtime version of Node.js 16.
What do you need to do?
If you do not want to see an automatic update from Node.js 16 to Node.js 18 in your Netlify Functions, you can manually set your preferred runtime version. The currently supported Node.js versions in Netlify Functions are 14, 16, and 18.
If you have any questions, please let us know in this thread.