azure-functions-nodejs-worker: WEBSITE_NODE_DEFAULT_VERSION not working in Linux

My WEBSITE_NODE_DEFAULT_VERSION is ~10, but if I check the actual Node version (context.log(process.version);) it prints v8.17.0. Is there another setting that affects the Node.js version?

I was pointed at that, when my app crashed with error message

Worker was unable to load function status: 'SyntaxError: Unexpected reserved word'
Stack: /home/site/wwwroot/common/xxx.js:195
  for await (const c of blobServiceClient.listContainers()) {
      ^^^^^

Which seems to be Node.js version related (for await supported after v10.0.0).

Investigative information

Please provide the following:

  • Timestamp: 2020-01-30 16:52:14.006
  • Function App name: dummyfunapp
  • Function name(s) (as appropriate): HttpTrigger
  • Invocation ID: e8f7c2eb-4c0d-4a5e-81e6-cdda996f5768
  • Region: West Europe

Repro steps

  1. Create Function App Runtime Version 2
  2. Create Function that does context.log(process.version);
  3. Run Function from Portal

Expected behavior

Output: v10.xx.xx

Actual behavior

Output: v8.17.0

Related information

  • I’m developing locally (VS Code) and publish function app via VS Code Tool
  • Function App OS: Linux
  • Runtime Version: 2.0.12969.0

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Reactions: 2
  • Comments: 25 (8 by maintainers)

Most upvoted comments

@awoSYS - Version here is overloaded, it means host.json schema version 2 (http://json.schemastore.org/host), which applies to functions runtime V2 & V3

A lot of the differences between Linux and Windows are a point in time thing (ex: not having a good way of changing Node.js versions). The Linux offering is much newer, and so there are some experiences that still need to be ironed-out. So at this moment in time, our Windows offering is going to be a smoother experience with fewer snags. That being said, there are talks on our end of switching Linux to be default for Node.js functions. We’re working towards parity between Windows and Linux experiences because it shouldn’t matter!

@mhoeger you where right, core tools had to be updated, sorry for not checking 😞 Thanks everybody for the great support!

I can confirm this works:

  1. Updated Core Tools to latest version (2.7.2936)
  2. Checked linuxFxVersion (it was NODE|10) az resource show --id /subscriptions/*****/resourceGroups/***-resource-group/providers/Microsoft.Web/sites/***-function-app
  3. Updated linuxFxVersion value to NODE|12 az resource update --id /subscriptions/*****/resourceGroups/***-resource-group/providers/Microsoft.Web/sites/***-function-app --set properties.siteConfig.linuxFxVersion='"NODE|12"'
  4. Ran local debugger and it worked like a charm

@mathiasmaerker - what version of core tools are you using? It looks like an older version of V2, which blocked using node 12 before it was LTS. See supported node versions per function version here: https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-node#node-version

@divyagandhii I tried to follow the resource explorer route, but the property is not updated at all, I use az resource update --id /subscriptions/xxx/resourceGroups/puppeteer-test/providers/Microsoft.Web/sites/puppeteer-app2?api-version=2015-08-01 --set properties.siteConfig.linuxFxVersion='"node|12"' in power shell but the value is not set at all. is there any way in e.g. the portal on how to change this? Thanks for youe help

Regards Mathias

@rwebb-sgefdf @mhoeger is right…WEBSITE_NODE_DEFAULT_VERSION is not honored on Linux function apps. You need to set the ‘linuxfxversion’ property of your app to node|12 to make it a node 12 app. You can do this by either using the azure resource explorer - https://microsoft.github.io/AzureTipsAndTricks/blog/tip25.html or use any of the arm templates - https://docs.microsoft.com/en-us/azure/azure-functions/functions-infrastructure-as-code#create-a-function-app-2 to update your app’s linuxfxversion.