skip to Main Content

I unexpectedly began receiving a 502 Bad Gateway error for all of my HTTP-triggered functions in an Azure Function app that has been running successfully for the past few months.

After digging into the kudu logs, I found the following –

Failed to start a new language worker for runtime: node.
Microsoft.Azure.WebJobs.Script.Workers.Rpc.RpcException : Result: Failure
Exception: Worker was unable to load entry point "index.js": Found zero files matching the supplied pattern
Stack: Error: Worker was unable to load entry point "index.js": Found zero files matching the supplied pattern
    at C:Program Files (x86)SiteExtensionsFunctions4.12.0workersnodedistsrcworker-bundle.js:2:44797
    at Generator.next (<anonymous>)
    at o (C:Program Files (x86)SiteExtensionsFunctions4.12.0workersnodedistsrcworker-bundle.js:2:44124)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at async Microsoft.Azure.WebJobs.Script.Grpc.GrpcWorkerChannel.StartWorkerProcessAsync(CancellationToken cancellationToken) at /_/src/WebJobs.Script.Grpc/Channel/GrpcWorkerChannel.cs : 271
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at async Microsoft.Azure.WebJobs.Script.Workers.Rpc.RpcFunctionInvocationDispatcher.InitializeJobhostLanguageWorkerChannelAsync(??) at /_/src/WebJobs.Script/Workers/Rpc/FunctionRegistration/RpcFunctionInvocationDispatcher.cs : 154
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at async Microsoft.Azure.WebJobs.Script.Workers.Rpc.RpcFunctionInvocationDispatcher.InitializeJobhostLanguageWorkerChannelAsync(??) at /_/src/WebJobs.Script/Workers/Rpc/FunctionRegistration/RpcFunctionInvocationDispatcher.cs : 146
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at async Microsoft.Azure.WebJobs.Script.Workers.Rpc.RpcFunctionInvocationDispatcher.InitializeJobhostLanguageWorkerChannelAsync(??) at /_/src/WebJobs.Script/Workers/Rpc/FunctionRegistration/RpcFunctionInvocationDispatcher.cs : 137
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at async Microsoft.Azure.WebJobs.Script.Workers.Rpc.RpcFunctionInvocationDispatcher.<>c__DisplayClass56_0.<StartWorkerProcesses>b__0(??) at /_/src/WebJobs.Script/Workers/Rpc/FunctionRegistration/RpcFunctionInvocationDispatcher.cs : 229

I have not changed the file path settings and I was able to find the index.js source file inside of /dist in Kudu as is specified in my function.json binding.

My application configuration settings have Functions extension version set to ~4 and runtime set to Node ~16.
[Screenshot of Function App configuration settings for functions extension version and runtime][2]

In my deployment pipeline, the logs state that the app is being deployed with Node version 16.17.1, and Kudu logs further state that the specific version of the Functions extension tools being used is 4.12.0.

I have tried the following: restarting my application; updating my app configuration to explicitly set the Functions extension package to 4.12.1 (most recently released version); setting my Node version to 14; changing my App Service plan from consumption to premium to see if the error could be due in some way to cold starting; and explicitly setting the entry point of my HTTP-triggered functions in my function.json file. I have also updated my host.json file to update the ExtensionsBundle to use version 3.0.0 at the lowest:

{
  "version": "2.0",
  "extensionBundle": {
    "id": "Microsoft.Azure.Functions.ExtensionBundle",
    "version": "[3.3.0, 4.0.0)"
  }
}

I have seen this problem referenced on Stack Overflow, GitHub and Microsoft support forums related to .NET projects but have not been able to use these resources to resolve my issue.

3

Answers


  1. I don’t know if you still have this problem, I had the same problem since 0:00 UTC last night on one of my subscriptions and I just found a workaround: in despair I downgraded my Function apps from "~4" to "~3" … 502s and exceptions disappeared!

    Definitely not a long-term solution but I have a Production again and my customers can access their app.

    Login or Signup to reply.
  2. I was facing the same issue, and solved it by creating a new Function App and solving the problems when pre-validating migration from version 3 to 4.

    So my recommendation for you is to go to your Function App > Diagnose and Solve Problems menu, and search for "Functions 4.x Pre-Upgrade Validator".
    There you can check problems that may need to be solved before upgrading correctly to newest ~4 version.

    In my situation it was the name of the Function App, being > than 32 chars.

    You can find info regarding this topic in the official Azure Function Migration Guide.

    Regards!

    Login or Signup to reply.
  3. Had this issue for function app hosted on windows after upgrading node version to 18.x.x
    WEBSITE_NODE_DEFAULT_VERSION : ~18

    And our run time was 3.x
    but as per this
    it looks like Node 18 is only supported by runtime 4.x GA (Node.js 18, 16, & 14)

    This meant we had to upgrade the host json to update accordingly to support node 18

    Update config for function app was upgraded
    FUNCTIONS_EXTENSION_VERSION : ~4

    Final step was to restart the function app.

    after doing the above, solved the issue Failed to start a new language worker for runtime: node.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search