2
votes

I'm trying to create a durable function, so I have one function with a serviceBusTrigger, one with an orchestrationTrigger, and one with an activityTrigger. I'm doing something wrong in terms of registering the trigger bindings.

When I run locally, I get the following 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. build.AddAzureStorage(), build.AddServiceBus(), builder.AddTimers(), etc.).

The following 3 functions are in error:

: The binding type(s) 'serviceBusTrigger' are not registered. Please ensure the type is correct and the binding extension is installed.

: The binding type(s) 'orchestrationTrigger' are not registered. Please ensure the type is correct and the binding extension is installed.

: The binding type(s) 'activityTrigger' are not registered. Please ensure the type is correct and the binding extension is installed.

In .net core functions, it's my understanding that there is no startup file to expressly register the bindings in code. Instead, I've just installed the nuget packages that correspond to each type of trigger.

For example reference, here is my serviceBusTrigger function:

[FunctionName("Function_HttpStart")]
public static async Task Run(
    [ServiceBusTrigger("my-queuename", Connection = "ConnectionString")] RequestObject request,
    [OrchestrationClient]DurableOrchestrationClient starter,
    ILogger log)
{
    var instanceId = await starter.StartNewAsync("OtherFunction", request);

    log.LogInformation($"Started orchestration with ID = '{instanceId}'.");
}

and the function.json file that gets generated:

{
  "generatedBy": "Microsoft.NET.Sdk.Functions-1.0.24",
  "configurationSource": "attributes",
  "bindings": [
    {
      "type": "serviceBusTrigger",
      "connection": "ConnectionString",
      "queueName": "my-queueName",
      "name": "request"
    }
  ],
  "disabled": false,
  "scriptFile": "../bin/x.dll",
  "entryPoint": "Namespace.Project.Run"
}
2

2 Answers

1
votes

Make sure we don't install the package Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator separately. It's a package referenced by Microsoft.NET.Sdk.Functions, installing it explicitly makes the [FunctionProject]\bin\Debug\netcoreapp2.1\bin\extensions.json file(containing the binding extensions info) fail to generate.

The project file(right click on project, Edit [FunctionProject].csproj) should look like this:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netcoreapp2.1</TargetFramework>
    <AzureFunctionsVersion>v2</AzureFunctionsVersion>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.DurableTask" Version="1.7.1" />
    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.ServiceBus" Version="3.0.2" />
    <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.24" />
  </ItemGroup>
  <ItemGroup>
    <None Update="host.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <None Update="local.settings.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <CopyToPublishDirectory>Never</CopyToPublishDirectory>
    </None>
  </ItemGroup>
</Project>
2
votes

In my case, installing package named:

Microsoft.Azure.Webjobs.Extensions.ServiceBus

instead of:

Microsoft.Azure.Webjobs.ServiceBus

...helped solving the problem.