How to prevent a "No job functions found" in AzureFunctions v4 in case of an isolated worker process?
Asked Answered
F

4

5

I have some experience with Azure Functions but I am new to isolated worker process and v4.

I get this warning/error message:

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

Note that solutions from other posts may not work because of v4 or because of isolated worker process usage. My problem is similar but not the same.

Typing func --version gives this output:

4.0.5455

Here is my csproj:

<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="Microsoft.Azure.Functions.Worker" Version="1.20.0" />
        <PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.16.4" OutputItemType="Analyzer" />
        <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.1.0" />
    </ItemGroup>

</Project>

Here is my Program.cs:

using Microsoft.Extensions.Hosting;

namespace YourFunctionApp
{
    class Program
    {
        static void Main()
        {
            var host = new HostBuilder()
                .ConfigureFunctionsWorkerDefaults()
                .ConfigureServices(services =>
                {
                    // Add any additional services needed here
                })
                .Build();

            host.Run();
        }
    }
}

Here is my local.settings.json :

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "UseDevelopmentStorage=true",
    "FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated",
    "FUNCTIONS_EXTENSION_VERSION": "~4"
  }
}

Here is my host.json :

{
  "version": "2.0",
  "logging": {
    "applicationInsights": {
      "samplingSettings": {
        "isEnabled": true
      }
    }
  },
  "functionTimeout": "00:05:00"
}

In the properties folder, here is my serviceDependencies.json:

{
  "dependencies": {
    "appInsights1": {
      "type": "appInsights"
    }
  }
}

and my launchsettings.json:

{
  "profiles": {
    "FunctionApp3": {
      "commandName": "Project",
      "commandLineArgs": "--port 7111",
      "launchBrowser": false
    }
  }
}

To give some more context, I use VS 2022 on a Windows 10 Pro device. How can I get rid of this error/warning message to make my (basic) Azure Function app work?

Featurelength answered 20/12, 2023 at 16:43 Comment(1)
Related post - No job functions found. Try making your job classes and methods publicFoscalina
P
9

It's a known issue. You need to downgrade Microsoft.Azure.Functions.Worker.Sdk from 1.16.x to 1.15.1

See also https://github.com/Azure/Azure-Functions/issues/2168

Pre answered 11/1, 2024 at 3:6 Comment(0)
M
1

Not specific to this question as the setting looks correct in the example, but we have upgraded our Function App many times and I don't think that any of the upgrade steps ever updated the local.settings.json to set the FUNCTIONS_WORKER_RUNTIME from dotnet to dotnet-isolated.

Simple fix but it took several hours to find.

Mosely answered 8/8, 2024 at 20:30 Comment(0)
L
0

The error message "No job functions found" in Azure Functions indicates that the Azure Functions runtime could not find any functions to execute within your project.

I have created an HTTP-triggered Azure Function v4 with a runtime stack of .NET 6.0 isolated process in Visual Studio. To run the Function App, there must be at least one function in the application. In my Function App, I used an HTTP trigger function. Please see below:

enter image description here

.csproj:

<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="Microsoft.Azure.Functions.Worker" Version="1.20.0" />
    <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.1.0" />
    <PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.16.2" />
    <PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="2.21.0" />
    <PackageReference Include="Microsoft.Azure.Functions.Worker.ApplicationInsights" Version="1.0.0" />
  </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>

function code:

using System.Net;
using Microsoft.Azure.Functions.Worker;
using Microsoft.Azure.Functions.Worker.Http;
using Microsoft.Extensions.Logging;

namespace FunctionApp1011
{
    public class Function1
    {
        private readonly ILogger _logger;

        public Function1(ILoggerFactory loggerFactory)
        {
            _logger = loggerFactory.CreateLogger<Function1>();
        }

        [Function("Function1")]
        public HttpResponseData Run([HttpTrigger(AuthorizationLevel.Function, "get", "post")] HttpRequestData req)
        {
            _logger.LogInformation("C# HTTP trigger function processed a request.");

            var response = req.CreateResponse(HttpStatusCode.OK);
            response.Headers.Add("Content-Type", "text/plain; charset=utf-8");

            response.WriteString("Welcome to Azure Functions!");

            return response;
        }
    }
}

Program.cs:

using Microsoft.Azure.Functions.Worker;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;

var host = new HostBuilder()
    .ConfigureFunctionsWorkerDefaults()
    .ConfigureServices(services =>
    {
        services.AddApplicationInsightsTelemetryWorkerService();
        services.ConfigureFunctionsApplicationInsights();
    })
    .Build();
host.Run();

host.json:

{
    "version": "2.0",
    "logging": {
        "applicationInsights": {
            "samplingSettings": {
                "isEnabled": true,
                "excludedTypes": "Request"
            },
            "enableLiveMetricsFilters": true
        }
    }
}

local.settings.json:

{
    "IsEncrypted": false,
    "Values": {
        "AzureWebJobsStorage": "Your azure storage-connection string",
        "FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated"
    }
}

The above Http trigger function executed successfully. Check below:

Output:

enter image description here

Loquitur answered 21/12, 2023 at 10:32 Comment(0)
M
0

In my case, it was an issue with local.settings.json file. An extra double quote character that I had unknowingly added to the file was giving me this error. Post rectifying that, the solution was working.

Martyry answered 10/4, 2024 at 8:53 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.