2

I've read thru the doc and created a new azure function with the VS Code extension just using the boilerplate code it spits out.

Then I set this up locally in local.settings.json (I'm on Windows)

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "",
    "FUNCTIONS_WORKER_RUNTIME": "node",
    "FUNCTIONS_EXTENSION_VERSION": "~4",
    "WEBSITE_NODE_DEFAULT_VERSION": "~16"
  }
}

But I still get that node version is an incompatible error.

ihor.eth
  • 2,207
  • 20
  • 27
  • Did it work with node v14 ? May be the latest node version has an issue. For local debugging the official doc says to add [this entry](https://learn.microsoft.com/en-us/azure/azure-functions/functions-reference-node?tabs=v2#local-debugging) – Anand Sowmithiran Dec 21 '21 at 05:15
  • @AnandSowmithiran it did work with v14. Then when I deployed confirmation window popped up saying I was deploying version 4. confusing. – ihor.eth Dec 21 '21 at 05:39
  • Try removing other npm versions and just install v16 – Anand Sowmithiran Dec 21 '21 at 05:52
  • @AnandSowmithiran im using nvm so when I switch to 16 or any other that's the only one installed on PATH – ihor.eth Dec 21 '21 at 06:39

2 Answers2

6

Make sure your Function core tools version and Function Run time version should be 4.*.

enter image description here

If the version are not 4.*. install the Function Core Tools latest version check here & install required version of node js if you are using windows the version should be (16.9.1) for Linux you can use (16.13.0)

Azure Functions support for Node.js 16.x is now in public preview in Azure Functions runtime 4.0. Node.js 16.13.0, the current LTS version, is available on Linux function apps. Windows function apps currently support version 16.9.1 and will be updated to an LTS version in December 2021. Refer here

Check your settings.json file targeting projectRuntime has ~4 and projectLanguage has javascript

{
"azureFunctions.deploySubpath": ".",
"azureFunctions.postDeployTask": "npm install (functions)",
"azureFunctions.projectLanguage": "JavaScript",
"azureFunctions.projectRuntime": "~4",
"debug.internalConsoleOptions": "neverOpen",
"azureFunctions.preDeployTask": "npm prune (functions)"
}

enter image description here

Delliganesh Sevanesan
  • 4,146
  • 1
  • 5
  • 15
  • I upvoted but not sure if this is the solution since I somehow fixed it and moved on. Thanks for the help though! – ihor.eth Apr 04 '22 at 02:55
1

I faced this issue with Node V16.17.0 and azure function core tools V4*

I used command to trace logs

func host start --verbose

Then I saw in logs that it's trying to download Microsoft.Azure.Functions.ExtensionBundle.zip (with some version) to specific folder. In my case it was Microsoft.Azure.Functions.ExtensionBundle.2.13.0.zip

I manually downloaded that file and extracted zip to downloads folder.

Then I sas in logs that before downloading this zip file, It is checking if this file already exists in temp folder and in users folder as well. In my case it was C:\Users\<UserID>\.azure-functions-core-tools\Functions\ExtensionBundles\Microsoft.Azure.Functions.ExtensionBundle

and C:\Users\UserID>\AppData\Local\Temp\Functions\ExtensionBundles\Microsoft.Azure.Functions.ExtensionBundle\2.18.0

Make sure to create folder structure as well if not present.

I just copied contents from extracted folder to this mentioned location.

It worked.

Sandip Jadhav
  • 137
  • 1
  • 7