CodexBloom - Programming Q&A Platform

Azure Function Timeout implementing Durable Functions and External API Calls

πŸ‘€ Views: 109 πŸ’¬ Answers: 1 πŸ“… Created: 2025-06-15
azure-functions durable-functions http-client C#

I'm performance testing and I'm stuck trying to I'm building a feature where After trying multiple solutions online, I still can't figure this out... I'm experiencing timeout issues when using Azure Durable Functions to orchestrate calls to an external API. The orchestration function sometimes takes longer than the default timeout period, causing errors like `DurableFunctionTimeoutException`. I've set up my function with the following attributes: ```csharp [FunctionName("MyOrchestrator")] public static async Task RunOrchestrator( [OrchestrationTrigger] IDurableOrchestrationContext context) { var result = await context.CallActivityAsync<string>("MyActivity", null); // Further processing... } ``` And my activity function is as follows: ```csharp [FunctionName("MyActivity")] public static async Task<string> ExecuteActivity([ActivityTrigger] string input, ILogger log) { using (var client = new HttpClient()) { client.Timeout = TimeSpan.FromMinutes(2); // Trying to extend timeout var response = await client.GetAsync("https://externalapi.com/data"); response.EnsureSuccessStatusCode(); return await response.Content.ReadAsStringAsync(); } } ``` Despite setting a longer timeout for the HttpClient, the orchestration function seems to hit the default function timeout of 5 minutes. I've already tried increasing the function timeout via the host.json configuration: ```json { "functionTimeout": "00:10:00" } ``` However, it doesn’t seem to affect the orchestration timeout. I’ve also confirmed that I have the correct settings in the Azure portal, ensuring that the app service plan allows for longer execution times. I'm using Azure Functions v3, and the service plan is set to Premium. Is there anything I might be missing or additional configurations needed to handle longer-running operations with Durable Functions effectively? Any suggestions or best practices would be appreciated. I'd really appreciate any guidance on this. How would you solve this? Am I missing something obvious? The project is a CLI tool built with C#. I'd really appreciate any guidance on this. For reference, this is a production microservice. Has anyone dealt with something similar?