CodexBloom - Programming Q&A Platform

Azure Functions with Durable Functions: implementing External Events Timing Out

πŸ‘€ Views: 23 πŸ’¬ Answers: 1 πŸ“… Created: 2025-06-09
azure-functions durable-functions timeout C#

I'm deploying to production and Can someone help me understand I am currently implementing an Azure Durable Function that waits for external events to complete a workflow. The setup involves an HTTP starter function that orchestrates the process, and I'm using the `DurableOrchestrationContext.WaitForExternalEvent<T>()` method to listen for signals from an external service. However, I'm working with a timeout scenario where the orchestration instance is terminating before I receive the external event, resulting in a `Function Timeout` behavior. Here’s a rough structure of my orchestration function: ```csharp public static async Task RunOrchestrator([OrchestrationTrigger] IDurableOrchestrationContext context) { var taskId = context.GetInput<string>(); var status = await context.WaitForExternalEvent<string>("ExternalEventName"); if (status == null) { throw new Exception("Received null status from external event."); } // process the received status } ``` I have set a timeout of 5 minutes for my function, but the external service sometimes takes longer to respond. I tried to extend the timeout by modifying the `functionTimeout` setting in my function app's host.json like this: ```json { "functionTimeout": "00:10:00" } ``` However, the orchestration is still timing out after the default duration. Additionally, I am using the latest version of the Azure Functions SDK (v4.0.0) and Durable Task Framework (v2.5.0). I've also verified that the external service is indeed sending the event, but it seems to be delayed. Is there a recommended way to handle scenarios like this where external events may arrive later than expected without terminating the orchestration? Should I consider implementing a retry mechanism or a different approach to wait for external events? What are your experiences with this? Thanks for taking the time to read this!