Home > Software engineering >  Azure Function Node.js Failed to start a new language worker for runtime: node
Azure Function Node.js Failed to start a new language worker for runtime: node

Time:09-28

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)\SiteExtensions\Functions\4.12.0\workers\node\dist\src\worker-bundle.js:2:44797
    at Generator.next (<anonymous>)
    at o (C:\Program Files (x86)\SiteExtensions\Functions\4.12.0\workers\node\dist\src\worker-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.

CodePudding user response:

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.

  • Related