3

I have developed an Azure Function v4 with .net 6.0. It contains only http triggered functions.

Locally everything works fine, but after deploying it to Azure i only get 500 Status Code by calling any endpoint and it always throws InvalidOperationException at Microsoft.Azure.WebJobs.Script.Workers.Rpc.RpcFunctionInvocationDispatcherLoadBalancer.GetLanguageWorkerChannel : Did not find any initialized language workers

  • Application settings

enter image description here

  • Operating System: Windows
  • Runtime Version: 4.0.1.16815
  • Location: West Europe

Update Add more information

Project file:

<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        <TargetFramework>net6.0</TargetFramework>
        <AzureFunctionsVersion>v4</AzureFunctionsVersion>
        <OutputType>Exe</OutputType>
        <ImplicitUsings>enable</ImplicitUsings>
        <Nullable>enable</Nullable>
    </PropertyGroup>
    <ItemGroup>
        <PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="11.0.0" />
        <PackageReference Include="Microsoft.ApplicationInsights" Version="2.20.0" />
        <PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.6.0" />
        <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.OpenApi" Version="1.0.0" />
        <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.0.13" />
        <PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.3.0" OutputItemType="Analyzer" />
    </ItemGroup>
    <ItemGroup>
        <None Update="host.json">
            <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
        </None>
        <None Update="local.settings.json">
            <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
        </None>
    </ItemGroup>
</Project>

local.settings.json


{
    "IsEncrypted": false,
    "Values": {
        "AzureWebJobsStorage": "UseDevelopmentStorage=true",
        "FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated",
        "StorageConnectionString": "UseDevelopmentStorage",
        "APPINSIGHTS_INSTRUMENTATIONKEY": "MyInstrumentationKey"
    },
    "Host": {
        "LocalHttpPort": 7071,
        "CORS": "*"
    }
}
DerDani81
  • 987
  • 11
  • 24

1 Answers1

1

One of the workaround to resolve this issue:

  1. Created Azure Functions (Stack: .Net 6 Isolated) in Visual Studio and run locally:

enter image description here

  1. After deploying of Function App in the Azure Portal (Stack: .Net 6, Location: West Europe, OS: Windows, Plan: Consumption, Function Runtime: Isolated)

This is the configuration: enter image description here

After deploying, the function URL is running successfully:

enter image description here


  1. As I can see a setting called WEBSITE_NODE_DEFAULT_VERSION is added into your .Net Function App Configuration Settings.

enter image description here

If your function is not created with node.js and if you are not using this application setting explicitly in your code then you can remove this property from your function app. This is stated in this MSFT Q&A.

  1. The other reasons for this kind of error would be
    • The Functions Runtime is initialized but it failed to initialize the Language Worker. So, the Functions Runtime detects that the worker channel has not started and logs the error message on further invocations.

Note: 5. Try Re-creation of the Function App (.Net 6 - Windows OS- West Europe Location) in the Azure Portal and deploy your HTTP Trigger Function from Visual Studio. Or 6. Try removing the WEBSITE_NODE_DEFAULT_VERSION setting > Save > Restart the app in the azure portal and run the function. 7. Make sure this setting is "FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated" in your function app local.settings.json file. 8. This error may exist due to unmatching of Functions worker version and SDK version. If any updates available, please update them through NuGet Packet Manager: enter image description here

Also, this error exist in previous version of dotnet Isolated is 5 and in Azure Functions Version V3.

References:

  1. azure-functions-dotnet-worker/issues
  2. https://github.com/Azure/azure-functions-host/issues/7618.
  3. SO Thread1
  • thx for the detailled answer. The workaround doesn't change anything. – DerDani81 Jan 19 '22 at 08:33
  • Worker packages are all up-to-date. And Configuration settings are as you mentioned. Removing the WEBSITE_NODE_DEFAULT_VERSION also not changed anything. – DerDani81 Jan 19 '22 at 08:35
  • @DerDani81 did you try to update the worker package versions in your function app if any updates are available and redeploy it. –  Jan 19 '22 at 09:06
  • And after removing `website_node_default_version` setting, could you please try re-publishing the function to the azure and check? –  Jan 19 '22 at 09:06
  • nothing changed after re-deploy. – DerDani81 Jan 19 '22 at 09:08
  • @DerDani81 did you try to update the worker package versions in your function app if any updates are available? If the function worker runtime version is unmatched, then this kind of issue occurs sometimes. –  Jan 19 '22 at 09:10
  • worker packages are already up-to-date: – DerDani81 Jan 19 '22 at 09:23
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/241197/discussion-between-harikrishnarajoli-mt-and-derdani81). –  Jan 19 '22 at 09:35
  • @DerDani81, Any update to the issue? –  Jan 29 '22 at 01:25