Share via

Clarification on Azure Functions update from Node.js 20 to 22

nchr1998 0 Reputation points
2026-04-29T19:46:00.0866667+00:00

Hello, I’m upgrading Azure Functions (behind API Management) from Node.js 20 to 22 due to end of support.

  • Is updating the Azure Function by going to Configuration → Stack settings → Version sufficient, or are additional steps required?
  • Does this upgrade require moving to programming model v4, and how should that be done?

According to Microsoft documentation, Node.js 22 requires programming model version 4.x: https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-node?tabs=javascript%2Cwindows%2Cazure-cli&pivots=nodejs-model-v3. I tested changing versions by changing a dev function from Node.js 20 to 22, and it worked without issues when called from the developer portal. However, I want to confirm this approach is safe for production.

Azure Functions
Azure Functions

An Azure service that provides an event-driven serverless compute platform.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Rakesh Mishra 8,420 Reputation points Microsoft External Staff Moderator
    2026-04-29T20:13:07.9733333+00:00

    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_VERSION app 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 linuxFxVersion site 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/functions npm 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:


  2. Q&A Assist
    2026-04-29T19:46:22.62+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    Updating only the Stack settings → Version to Node.js 22 is not sufficient by itself for a fully supported configuration. For Node.js 22, the app must use the Node.js programming model v4 with the corresponding package/runtime versions.

    From the documentation:

    • Programming model 4.x (GA) requires:
      • Azure Functions runtime: 4.25+
      • Node.js: 22.x, 20.x, 18.x
    • Programming model 3.x (GA) supports Node.js 20.x and 18.x, but not 22.x.
    • The programming model version is tied to the @azure/functions npm package version.
    • v4 requires @azure/functions v4.0.0+ and Node.js v18+.

    Therefore, for a production-safe upgrade to Node.js 22:

    1. Confirm the runtime and model requirements
      • Ensure the Function App is on Functions runtime v4.25+.
      • Plan to move to the v4 programming model if not already using it.
    2. Upgrade to the v4 programming model (JavaScript/TypeScript) At minimum, this involves:
      • Add/upgrade the npm package:
             npm install @azure/functions
        
        Ensure @azure/functions is in the dependencies section of package.json, not devDependencies.
      • Ensure the Node.js version in the app meets v4 requirements (Node.js v18+; for Node 22 specifically, this is satisfied).
      • For v4, define functions in code instead of function.json:
        • Move trigger/binding configuration from function.json into JavaScript/TypeScript using the app object (for example, app.http(), app.timer()).
      • Set the app entry point in package.json using the main field (for example, "main": "src/index.js" or a glob like "src/functions/*.js").
      • Adjust handler signatures to the v4 model where the trigger input is the first argument and the context is second and optional (for example, change (context, req) to (req, context) or just (req)).
    3. Do not mix v3 and v4 in the same Function App
      • As soon as one v4 function is registered, any v3 functions defined via function.json are ignored.
      • Plan a coordinated migration of all functions in the app to v4 before or together with the Node.js 22 switch.
    4. Then change Stack settings → Version to Node.js 22
      • After the codebase is on programming model v4 and dependencies/runtime meet the requirements, updating the stack version to Node.js 22 is the correct and supported step.
      • The fact that a dev function “works” after only changing the stack version does not guarantee it is within the supported matrix; for production, align with the documented support table and v4 requirements.

    In summary: for Node.js 22, move the Function App to Node.js programming model v4 (including @azure/functions v4, code-based configuration, and correct entry point), ensure Functions runtime v4.25+, and then update the stack version. Relying solely on changing the stack version in the portal is not sufficient for a fully supported production configuration.


    References:

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.