We are using Durable Functions in an Azure Function App as a backend. The frontend is hosted using Azure Static Web App and the API is linked so all the requests are proxied through the SWA. As a result it is hard to use the built-in status-query route (runtime/webhooks/durabletask/instances) as it isn’t exposed in SWA (maybe there is a way to do that?) so in the past we would have our own custom Function to get the status:
[FunctionName("GetStatus")]
public async Task<DurableOrchestrationStatus> GetStatus([HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "status/{instanceId}")] HttpRequest req, [DurableClient] IDurableOrchestrationClient client, string instanceId)
{
return await client.GetStatusAsync(instanceId);
}
This is fine as the DurableOrchestrationStatus
contains the information we need such as the output
property to see potential errors. However after migrating to Isolated Process the interface has changed and it seems that we can only now use DurableTaskClient.GetInstanceAsync
which returns OrchestrationMetadata
however that doesn’t appear to contain the same info as DurableOrchestrationStatus
. It seems that the intended way is to call the runtime/webhooks/durabletask/instances
endpoint but I was hoping there was a way to access the same info so we can expose it through the SWA.
2
Answers
Yes, There are some Public API changes when you migrate to Isolated Functions, Refer this Table to get the correct method to get the Status of Azure Durable Functions isolated.
If you intend to expose orchestration status information through your Azure Static Web App (SWA) and find that the proxying of requests complicates the use of the built-in status-query route, one possible solution is to create a custom HTTP-triggered function. The DurableTaskClient provides the GetStatusAsync method. However, it returns OrchestrationInstance and OrchestrationRuntimeStatus, which may lack some of the detailed information found in the original DurableOrchestrationStatus.
Sample code that you can use:-
Also, When I created a Default
Durable .Net Isolated Function
and ranHttp_start function
, I received the Get status URI which you can call in your SWA by linking it with the Azure Functions, Refer below:-statusQueryGetUri:-
Refer my SO answer to link the Function with SWA and call it with the URL below:-
URL:-
How do you solve the problem with CreateCheckStatusResponse being synchronous and the method failing with ‘Synchronous operations are disallowed.’