CodexBloom - Programming Q&A Platform

Azure Function HTTP Trigger returns 500 Internal Server scenarios when using Durable Functions with Service Bus

πŸ‘€ Views: 1 πŸ’¬ Answers: 1 πŸ“… Created: 2025-06-11
azure-functions durable-functions service-bus csharp

I've spent hours debugging this and I'm working on a personal project and I tried several approaches but none seem to work. I am currently working on an Azure Function that uses Durable Functions and is triggered by an HTTP request. However, I keep getting a `500 Internal Server behavior` when trying to start the orchestration. The specific behavior message in the logs indicates `The operation has timed out` and `Unable to retrieve the status of the orchestration`. I have set up an Azure Service Bus to handle messaging between functions, but it seems like the orchestration is not communicating properly with the Service Bus queue. Here's a snippet of my HTTP trigger function: ```csharp [FunctionName("StartOrchestrator")] public static async Task<IActionResult> Run( [HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequest req, [DurableClient] IDurableOrchestrationClient starter, ILogger log) { log.LogInformation("C# HTTP trigger function processed a request."); string requestBody = await new StreamReader(req.Body).ReadToEndAsync(); var input = JsonConvert.DeserializeObject<MyInputType>(requestBody); string instanceId = await starter.StartNewAsync("MyOrchestrator", input); log.LogInformation($"Started orchestration with ID = '{instanceId}'."); return starter.CreateCheckStatusResponse(req, instanceId); } ``` This function starts the orchestration, but I’m unsure if the orchestration itself is configured correctly. Here’s what my orchestrator looks like: ```csharp [FunctionName("MyOrchestrator")] public static async Task RunOrchestrator([OrchestrationTrigger] IDurableOrchestrationContext context) { var input = context.GetInput<MyInputType>(); // Do some processing... await context.CallActivityAsync("MyActivity", input); } ``` I have also checked the following: - The connection string for the Service Bus is correctly configured in `local.settings.json` and in the Azure configuration. - The Service Bus instance is up and running, and I can send messages to it manually. - I am using the latest Durable Functions version `2.4.0` and Azure Functions runtime `v3.0`. Could this be an scenario with how Durable Functions are set up to work with Azure Service Bus? Any suggestions on what I might be missing or how to debug this further would be greatly appreciated! My development environment is macOS. How would you solve this? Is this even possible?