azureazure-functionsazure-durable-functionsazure-functions-isolated

Azure durable function exception No valid DurableTask client target was registered


I created an isolated Azure durable function. When trying to invoke a custom status endpoint I created which receives a DurableTaskClient as parameter to the constructor, I got this Exception:

System.InvalidOperationException: No valid DurableTask client target was registered. Ensure a valid client has been configured via 'UseBuildTarget(Type target)'. An example of a valid client is '.UseGrpc()'

I don't even use grpc at all.

This is my program.cs

var host = new HostBuilder()
    .ConfigureFunctionsWebApplication()
    .ConfigureServices(services =>
    {          
        services.AddDurableTaskClient();
    })
    .Build();

host.Run();

Solution

  • What I eventually did was passing the DurableTaskClient as a parameter to the Run method like this:

    public async Task<IActionResult> Run(
        [HttpTrigger(AuthorizationLevel.Function, "get", Route = "deploy/status/{instanceId}")] HttpRequestData req,
        string instanceId, [DurableClient] DurableTaskClient durableClient)