An Azure service that provides an event-driven serverless compute platform.
Hi nchr1998,
Welcome to the Microsoft Q&A Platform! Thank you for asking your question here.
Moving from Node.js 20 to 22 on Azure Functions is totally doable and relatively straightforward since both versions already run on the Azure Functions v4 runtime.
Here’s how to put that into practice:
1. Update the Node.js version to 22
Depending on your hosting OS, the setting you need to update differs:
If you’re on Windows:
- In the Azure Portal: Go to your Function App > Settings > Configuration > General settings > Stack settings and select Node.js 22 from the dropdown.
- Via App Settings / Azure CLI: Set the
WEBSITE_NODE_DEFAULT_VERSIONapp setting to~22.az functionapp config appsettings set \ --name <APP_NAME> \ --resource-group <RG_NAME> \ --settings WEBSITE_NODE_DEFAULT_VERSION=~22
If you’re on Linux:
- In the Azure Portal: Go to your Function App > Settings > Configuration > General settings > Stack settings and select Node.js 22.
- Via Azure CLI: Update the
linuxFxVersionsite config property to"node|22".az functionapp config set \ --name <APP_NAME> \ --resource-group <RG_NAME> \ --linux-fx-version "node|22"
2. Save & Restart Make sure to save your configuration changes in the portal. The Function App will automatically restart and begin using the new Node.js environment. It's always a best practice to smoke-test this in a staging slot or locally before applying the change directly to your production app.
A few extra tips:
- Programming Model: If you are still using the v3 Node.js Programming Model (how your JavaScript/TypeScript code is structured), Node.js 22 will still run it. However, it's highly recommended to upgrade to the v4 Programming Model (the
@azure/functionsnpm package v4) if you haven't already. - Linux Consumption Plan Note: Keep in mind that Node.js 22 is the last Node.js version supported for Linux Consumption plan apps. If you plan to upgrade to Node.js 24 or newer in the future, you will eventually need to migrate your app to the newer Flex Consumption plan.
Reference docs:
- Azure Functions Node.js developer guide: https://learn.microsoft.com/azure/azure-functions/functions-reference-node?tabs=v4#setting-the-node-version
- Supported Languages and end-of-support dates: https://learn.microsoft.com/en-us/azure/azure-functions/functions-versions#languages Note: This response is drafted with the help of AI systems.