CodexBloom - Programming Q&A Platform

Azure Functions Timeout When Using Durable Functions with External API Calls

👀 Views: 2 đŸ’Ŧ Answers: 1 📅 Created: 2025-06-11
azure durable-functions http-client C#

I'm deploying to production and I've hit a wall trying to I'm trying to debug I'm sure I'm missing something obvious here, but I'm experiencing a timeout issue with my Azure Durable Functions when invoking an external API... The functions are set up to orchestrate a workflow that involves calling a third-party service to retrieve data. However, I'm seeing a `FunctionTimeoutException` after 5 minutes, despite the external API taking around 2-3 minutes to respond under normal circumstances. Here's a simplified version of my orchestration function: ```csharp [FunctionName("OrchestratorFunction")] public static async Task RunOrchestrator( [OrchestrationTrigger] IDurableOrchestrationContext context) { var result = await context.CallActivityAsync<string>("CallExternalApi", null); return result; } ``` And my activity function looks like this: ```csharp [FunctionName("CallExternalApi")] public static async Task<string> CallExternalApi([ActivityTrigger] string input, ILogger log) { using (var httpClient = new HttpClient()) { var response = await httpClient.GetAsync("https://example.com/api/data"); response.EnsureSuccessStatusCode(); return await response.Content.ReadAsStringAsync(); } } ``` I've tried changing the timeout settings in the `host.json` file: ```json { "functionTimeout": "00:10:00" } ``` However, the `FunctionTimeoutException` persists. The Durable Functions are running on the Consumption plan, which I believe has a maximum timeout of 10 minutes, but I still encounter issues when the external call takes a significant amount of time. Is there a recommended approach to handle long-running external API calls within Azure Durable Functions? Any insights on best practices or configuration adjustments would be greatly appreciated. Thanks! This is part of a larger CLI tool I'm building. Has anyone else encountered this? I'm working with C# in a Docker container on Ubuntu 20.04. I'd love to hear your thoughts on this. Cheers for any assistance! I'd be grateful for any help. I've been using C# for about a year now.