CodexBloom - Programming Q&A Platform

Azure Functions: Timeout Issues When Using Durable Functions with HttpClient

πŸ‘€ Views: 47 πŸ’¬ Answers: 1 πŸ“… Created: 2025-06-12
azure-functions durable-functions httpclient C#

I'm performance testing and I'm testing a new approach and I've looked through the documentation and I'm still confused about This might be a silly question, but I'm working with a timeout scenario with my Azure Durable Functions when making HTTP calls using HttpClient. The function seems to execute properly up until the point where it tries to call an external API, but consistently times out after 100 seconds, resulting in the following behavior message: `System.Threading.Tasks.TaskCanceledException: The operation has timed out.` I've tried increasing the timeout on the HttpClient instance and even set the overall function timeout to 10 minutes in the `host.json`, but the question continues. Here’s the relevant snippet of my orchestration function: ```csharp [FunctionName("OrchestratorFunction")] public static async Task<string> RunOrchestrator([OrchestrationTrigger] IDurableOrchestrationContext context) { var result = await context.CallActivityAsync<string>("HttpClientActivity", null); return result; } ``` And for the activity function: ```csharp [FunctionName("HttpClientActivity")] public static async Task<string> HttpClientActivity([ActivityTrigger] string name, ILogger log) { using (var client = new HttpClient()) { client.Timeout = TimeSpan.FromMinutes(5); var response = await client.GetAsync("https://external-api.com/data"); response.EnsureSuccessStatusCode(); return await response.Content.ReadAsStringAsync(); } } ``` I also made sure that the external service is up and reachable from my Azure environment. I tested it locally, and the call works fine, but once deployed to Azure, I run into this timeout scenario. Any ideas on what could be causing this or how to properly configure my Durable Function to handle longer HTTP requests? Any help would be greatly appreciated! How would you solve this? Could this be a known issue? This is my first time working with C# 3.9. Any pointers in the right direction? What am I doing wrong?