CodexBloom - Programming Q&A Platform

Azure Function Timeout with Durable Functions: Awaiting External Events in Python

👀 Views: 0 đŸ’Ŧ Answers: 1 📅 Created: 2025-06-14
azure-functions durable-functions python Python

I'm having a hard time understanding I'm implementing an Azure Durable Function in Python that must wait for an external event to continue... I'm working with a timeout scenario where the function seems to be terminating before the external event is triggered, even though I've set the timeout for the orchestration to be 30 minutes. This is my orchestration function: ```python import azure.durable_functions as df async def main(context: df.DurableOrchestrationContext): external_event = await context.wait_for_external_event('event_name') return external_event ``` I have set up the external event trigger to call the following function: ```python def trigger_event(event_data): client = df.DurableOrchestrationClient(context) instance_id = "<instance_id>" client.raise_event(instance_id, 'event_name', event_data) ``` The event is being triggered correctly, but I get the behavior: `Function 'main' failed: The orchestration has been terminated due to a timeout.` I've also checked the function timeout settings in the function.json file: ```json { "bindings": [ { "type": "orchestrator", "name": "context", "direction": "in" } ], "timeout": "00:30:00" } ``` I've verified that the Durable Functions version I'm using is 1.8.1, and I tried increasing the timeout, but that didn't resolve the scenario. I also ensured that the function app settings have the `FUNCTIONS_WORKER_RUNTIME` set to `python`. Can anyone provide insights into why the orchestration might be timing out before the external event is received? What am I missing in my setup or logic? I'm working on a CLI tool that needs to handle this. My development environment is Ubuntu. Is there a better approach? For context: I'm using Python on macOS.