Azure / azure-functions-dotnet-worker

Azure Functions out-of-process .NET language worker
MIT License
414 stars 181 forks source link

No job functions found when deployed to app service plan function app #2656

Open dom380 opened 1 month ago

dom380 commented 1 month ago

What version of .NET does your existing project use?

.NET 6

What version of .NET are you attempting to target?

.NET 8

Description

The function app runs fine locally, but once deployed to Azure none of the functions are picked up and get the following log output

2024-08-09T15:42:06Z   [Verbose]   Handling WorkerErrorEvent for runtime:dotnet-isolated, workerId:dotnet-isolated. Failed with: System.TimeoutException: The operation has timed out.

   at Microsoft.Azure.WebJobs.Script.Grpc.GrpcWorkerChannel.PendingItem.OnTimeout() in /_/src/WebJobs.Script.Grpc/Channel/GrpcWorkerChannel.cs:line 1767
2024-08-09T15:42:06Z   [Verbose]   Attempting to dispose webhost or jobhost channel for workerId: '0f08fb98-ed55-4e47-86e9-644b355dfac2', runtime: 'dotnet-isolated'
2024-08-09T15:42:06Z   [Verbose]   No initialized worker channels for runtime 'dotnet-isolated'. Delaying future invocations
2024-08-09T15:42:06Z   [Verbose]   Restarting worker channel for runtime: 'dotnet-isolated'
2024-08-09T15:42:06Z   [Error]   Exceeded language worker restart retry count for runtime:dotnet-isolated. Shutting down and proactively recycling the Functions Host to recover
2024-08-09T15:42:06Z   [Information]   Reading functions metadata (Custom)
2024-08-09T15:42:06Z   [Information]   1 functions found (Custom)
2024-08-09T15:42:06Z   [Information]   0 functions loaded
2024-08-09T15:42:06Z   [Verbose]   FUNCTIONS_WORKER_RUNTIME value: 'dotnet-isolated'
2024-08-09T15:42:06Z   [Verbose]   Adding Function descriptor provider for language dotnet-isolated.
2024-08-09T15:42:06Z   [Verbose]   Creating function descriptors.
2024-08-09T15:42:06Z   [Verbose]   Function descriptors created.
2024-08-09T15:42:06Z   [Verbose]   Placeholder mode is enabled: False
2024-08-09T15:42:06Z   [Verbose]   RpcFunctionInvocationDispatcher received no functions
2024-08-09T15:42:06Z   [Information]   Generating 0 job function(s)
2024-08-09T15:42:06Z   [Warning]   No job functions found. Try making your job classes and methods public. If you're using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.).
2024-08-09T15:42:06Z   [Information]   Initializing function HTTP routes

No HTTP routes mapped

2024-08-09T15:42:06Z   [Information]   Host initialized (60131ms)
2024-08-09T15:42:06Z   [Information]   Host started (60139ms)
2024-08-09T15:42:06Z   [Information]   Job host started
2024-08-09T15:42:06Z   [Verbose]   File event source initialized.

The app settings and app stack are correct as far as I can tell: image

image

And going into kudu I can see the package appears to have been deployed correctly: image

Project configuration and dependencies

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <AzureFunctionsVersion>v4</AzureFunctionsVersion>
    <OutputType>Exe</OutputType>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <FunctionsInDependencies>true</FunctionsInDependencies>
    <RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
    <CodeAnalysisRuleSet>..\..\stylecop.ruleset</CodeAnalysisRuleSet>
  </PropertyGroup>
  <ItemGroup>
    <FrameworkReference Include="Microsoft.AspNetCore.App" />
    <PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.23.0" />
    <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.2.0" />
    <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore" Version="1.3.2" />
    <PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.17.4" />
    <PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="2.22.0" />
    <PackageReference Include="Microsoft.Azure.Functions.Worker.ApplicationInsights" Version="1.3.0" />
    <PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556">
        <PrivateAssets>all</PrivateAssets>
        <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.7">
        <PrivateAssets>all</PrivateAssets>
        <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
  </ItemGroup>

    <ItemGroup>
        <ProjectReference Include="..\Eso.CommService.Data\Eso.CommService.Data.csproj" />
    </ItemGroup>

  <ItemGroup>
    <None Update="host.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <None Update="local.settings.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <CopyToPublishDirectory>Never</CopyToPublishDirectory>
    </None>
  </ItemGroup>
  <ItemGroup>
    <Using Include="System.Threading.ExecutionContext" Alias="ExecutionContext" />
  </ItemGroup>
</Project>

Link to a repository that reproduces the issue

No response

mitalshah30 commented 1 month ago

@dom380 , I had similar issue and I had to downgrade <PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.16.4" /> from 1.17.4 to 1.16.4 in order to make it work. There are publishing issues in newer version it seems.

dom380 commented 1 month ago

@dom380 , I had similar issue and I had to downgrade <PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.16.4" /> from 1.17.4 to 1.16.4 in order to make it work. There are publishing issues in newer version it seems.

Thanks for the tip, I'll try that out but the same build of the app is working fine in another environment that's identical other than the azure region (canc vs scus)

dom380 commented 1 month ago

@mitalshah30 Unfortunately downgrading the SDK made no difference