1

I am trying to create azure durable functions for my project and get the following error for the code below.

    [Function("OrdersQueueFunction")]
    public async Task Run([QueueTrigger("bpbordersqueue")] [DurableClient] IDurableOrchestrationClient orchestrationClient, string orderData, ILogger log)
    {
        log.LogInformation($"C# Queue trigger function processed: {orderData}");
        var orderValue = JsonSerializer.Deserialize<Order>(orderData);
        await orderService.SaveData(orderValue);

        if (orderValue.Status == Order.OrderStatus.Pending)
        {
            string instanceId = await orchestrationClient.StartNewAsync("OrchestrateRequestApproval", requestMetadata);
            log.LogInformation($"Durable Function Ochestration started: {instanceId}");
        }
    }

Error:

Error   AZFW0001    The attribute 'DurableClientAttribute' is a WebJobs attribute and not supported in the .NET Worker (Isolated Process).
Karthikeyan VK
  • 5,310
  • 3
  • 37
  • 50

1 Answers1

1

Change the [Function("OrdersQueueFunction")] to [FunctionName("OrdersQueueFunction")].

Install the NuGet package Microsoft.Azure.WebJobs.Extensions.Storage and Microsoft.Azure.WebJobs.Extensions.DurableTask.

When I tried with your code initially even, I got the below error.

enter image description here

  • In namespace section add the DurableClientAttribute as below.
using DurableClientAttribute = Microsoft.Azure.Functions.Worker.DurableClientAttribute;

My namespaces:

using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.DurableTask;
using Microsoft.Extensions.Logging;
using DurableClientAttribute = Microsoft.Azure.Functions.Worker.DurableClientAttribute;
Harshitha
  • 3,784
  • 2
  • 4
  • 9