Node.js version 8 reaches End of Life (EOL) on December 31, 2019. AWS Lambda, the service behind Netlify Functions, will stop supporting serverless function deploys using Node.js 8 on January 6, 2020.
If you created your site after December 4, 2019, or you have set your site to use a custom Node.js version at 10 or above, nothing. Functions on these sites are already using a newer version of Node.js, and won’t be affected by the change on January 6.
For many functions, upgrading from version 8 to 12 will have no effect, and they’ll continue to run fine. 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!
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 devcommand. 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 locking your deploys and updating the functions runtime. With your deploys locked, you can test your functions on any deploy without the risk of accidentally deploying a change to production. You can set the functions runtime to any 10.x or 12.x version supported by AWS Lambda, then trigger a branch deploy and test the functions in that deploy. If you need to deploy to production while you’re testing, you can set the runtime back to version 8.x before unlocking deploys.
- Test on Netlify by creating a new test site from your existing repo. This works a lot like the previous option, but with a bit less risk and possibly less hassle. If you want to use Node.js 12, you don’t even have to set the runtime, since new sites use version 12 by default. You can still set the runtime if you want to use version 10, or a more specific version of 12.x.
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:
- Update Now! blog post on Rising Stack
- Making Node.js 8.x upgrade plans on Si Novi’s blog
- Deprecation release notes for Node.js v10.0.0
- Understanding the Buffer Deprecation in Node.js 10 on The NodeSource Blog
Also, always remember the Netlify Community 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.