Azure-Functions icon indicating copy to clipboard operation
Azure-Functions copied to clipboard

"No job functions found." reported when jobs are there + Functions tab empty

Open tymtam2 opened this issue 3 years ago • 57 comments

This is functions 4.1.3.17473

Sometimes:

  1. Application Insights reports the following 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.). with category: Host.Startup

  2. The Functions tab shows no functions

I haven't been able to pinpoint what triggers this error. I have experienced situations that without an obvious reason (so no deployment, no restart, no new requests) the Function tab starts displaying the functions after it was empty.

This seems to affect function apps with Http and EventHub triggers.

The classes containing the Run methods are public and the Run method is decorated with [FunctionName("MyAmazingFunction")]

tymtam2 avatar Feb 24 '22 07:02 tymtam2

Hi @tymtam2 , Thank you for your feedback! If you are using Azure Functions in .NET 5 with the out-of-process execution model you need to replace your FunctionName with Function, otherwise the function will not be detected.

Before:

[FunctionName("CreateData")] After:

[Function("CreateData")]

Here is the official document - https://docs.microsoft.com/en-us/azure/azure-functions/dotnet-isolated-process-guide?tabs=browser&pivots=development-environment-vs#rename-the-function

Please check and let us know if this helps.

v-bbalaiagar avatar Feb 24 '22 10:02 v-bbalaiagar

@v-bbalaiagar Thanks for you comment.

Here's some more info

  1. I'm using .NET 6
  2. I cannot see FunctionAttribute so I canot use [Function("CreateData")]
  3. Why or how would it work intermittently? I have the same code deployed in another resource group and it works.

tymtam2 avatar Feb 25 '22 00:02 tymtam2

According to https://stackoverflow.com/questions/55802391/settings-website-contentshare-and-website-contentazurefileconnectionstring-i

missing WEBSITE_CONTENTAZUREFILECONNECTIONSTRING and WEBSITE_CONTENTSHARE could cause No job functions found. warning.

This makes this issue related to https://github.com/Azure/Azure-Functions/issues/2169

However after adding WEBSITE_CONTENTAZUREFILECONNECTIONSTRING and WEBSITE_CONTENTSHARE No job functions found. warning is still appearing in logs and Functions tab is empty.

tymtam2 avatar Feb 25 '22 02:02 tymtam2

As far as I remember redeployment of the function fixes the issue for some time.

Restarting the function app does not fix the issue.

tymtam2 avatar Feb 25 '22 03:02 tymtam2

Hi @tymtam2 , Thank you for the update. We will investigate this further and update you with the findings.

v-bbalaiagar avatar Feb 25 '22 09:02 v-bbalaiagar

Excellent. The issue is still tagged with 'Needs%3A%20Author%20feedback'. Do you need extra information?

Here are the important bits about the project:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <AzureFunctionsVersion>v4</AzureFunctionsVersion>
    <Nullable>enable</Nullable>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Azure.Messaging.EventHubs" Version="5.6.2" />
    <PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.1.0" />
    <PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="6.0.0">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.0.1" />
    <PackageReference Include="StackExchange.Redis" Version="2.2.88" />
    <PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.406">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
  </ItemGroup>

The function project references one project wich in turn references the following packages:

 <ItemGroup>
    <PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="6.0.0">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0" />
    <PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.406">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
  </ItemGroup>

tymtam2 avatar Feb 28 '22 01:02 tymtam2

Any news on this?

SirSavio avatar May 13 '22 12:05 SirSavio

I am also experiencing a similar issue with .NET 6 functions on the consumption plan. My function app was working great for over 20 days after deployment and then one day stopped running. It logged the No job functions found for a while and then stopped.

Restarting the function app fixed the issue for about 8 hours until it happened again. About an hour ago I redeployed to the function and it's been working since, but I'm worried the issue will happen again.

brandenlivermore avatar May 13 '22 22:05 brandenlivermore

One more case here: deploying an Azure function using containers and getting that annoying No job functions found message.

After lots of reading and investigating, I think I've narrowed the problem down to the creation of the container. If I build my container locally using docker build and then I run it using docker run I get the same error message and my function is not working:

image

This is how my docker file looks like:

FROM mcr.microsoft.com/azure-functions/dotnet:4 AS base WORKDIR /home/site/wwwroot EXPOSE 80

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build WORKDIR /src COPY ["MyProject.csproj", "MyProject/"] RUN dotnet restore "MyProjectFolder/MyProject.csproj" COPY . . WORKDIR "/src/MyProject" RUN dotnet build "MyProject.csproj" -c Release -o /app/build

FROM build AS publish RUN dotnet publish "MyProject.csproj" -c Release -o /app/publish

FROM base AS final WORKDIR /home/site/wwwroot COPY --from=publish /app/publish . ENV AzureWebJobsScriptRoot=/home/site/wwwroot
AzureFunctionsJobHost__Logging__Console__IsEnabled=true

Note that I had to change the line first COPY line from COPY ["MyProjectFolder/MyProject.csproj", "MyProject/"] to COPY ["MyProject.csproj", "MyProject/"] in order to make it work. Otherwise, it was failing because it was not finding the project file.

I've already tried some other approaches like the one in this SO post but still getting the same error and no idea what's failing in here.

I'll keep looking for the solution. Let me know if anyone has any suggestions, ideas or even the right thing to do. They all will be welcomed.

sayago69 avatar May 16 '22 02:05 sayago69

Hello everyone, I'm experiencing the same issue. I have an Azure Function project developed in .net 6. Everything worked well for around 20 days and than it just stopped getting triggered by the configured EventHubTrigger. Recreating or redeploying the function worked for a few times but now it seems to have stopped forever. It doesn't even work anymore in my local computer. I already checked all the connection strings and quotas and it's all good. I'm sure my event hub has messages to deliver.

Here is my csproj file if it can help somehow

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net6.0</TargetFramework>
    <AzureFunctionsVersion>v4</AzureFunctionsVersion>
	<ImplicitUsings>enable</ImplicitUsings>
	<Nullable>enable</Nullable>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.EventHubs" Version="5.1.0" />
    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Sql" Version="0.1.286-preview" />
    <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.1.1" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\ModbusEnergyReaderIoT.Shared\ModbusEnergyReaderIoT.Shared.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>
    <Folder Include="Properties\PublishProfiles\" />
  </ItemGroup>
</Project>

Of course I get the "No job functions found." error too.

UPDATE: I really don't know how to explain this to myself, but just starting the function in local with --verbose without any other change made it restart working magically. Than I could find that the reason it didn't get triggered anymore in the cloud was an error parsing the SqlOuptutTrigger configuration. It still doesn't make sense that the configuration worked fine for nearly a month but it now works.

GabrieleVolpato avatar May 26 '22 09:05 GabrieleVolpato

I am facing the same error, I just created Azure function with Event Hub Trigger, .net version is .NET6 and function version is v4.

Below is the error:

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.).

jainindore avatar Aug 24 '22 16:08 jainindore

What is the status on this issue?

Experiencing the No job functions found issue as well, in my case, the functions are in a docker container that is published in a private container registry.

We deploy the functions with the container via a pipeline in an app service. We see via the Kudu app in the docker logs that the pull is successful, however, the function runtime reports that there are no job functions found.

When I pull the image locally, and run it, the test function executes just fine, so the container is fine I believe.

sergevm avatar Sep 22 '22 15:09 sergevm