[Bug] PYTHON_ENABLE_OPENTELEMETRY=true crashes every async invocation (NoneType.extract) on v2 runtime, Python 3.13
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- azure, python
- Domain
- backend, observability-sre
Research direction
Start in runtimes/v2/azure_functions_runtime/handle_event.py at worker_init and compare the PYTHON_ENABLE_OPENTELEMETRY branch with the PYTHON_APPLICATIONINSIGHTS_ENABLE_TELEMETRY path. Then inspect runtimes/v2/azure_functions_runtime/otel.py at configure_opentelemetry; done means async invocations no longer fail when the setting is enabled and trace context is initialized or handled safely.
Written by the indexing model from the issue text.
Description
Expected Behavior
With host.json telemetryMode: OpenTelemetry and app setting PYTHON_ENABLE_OPENTELEMETRY=true, async functions should invoke normally (the worker should either initialize the OpenTelemetry trace-context propagator or no-op safely)
Actual Behavior
Every async invocation returns HTTP 500. In v2 worker_init (runtimes/v2/azure_functions_runtime/handle_event.py), PYTHON_ENABLE_OPENTELEMETRY=true only calls otel_manager.set_otel_libs_available(True) and never calls update_opentelemetry_status() (unlike the PYTHON_APPLICATIONINSIGHTS_ENABLE_TELEMETRY path). The propagator stays None, so per-invocation context activation crashes:
AttributeError: 'NoneType' object has no attribute 'extract'
File ".../azure_functions_runtime/otel.py", line 112, in configure_opentelemetry
ctx = otel_manager.get_trace_context_propagator().extract(carrier)
Removing the setting makes the app healthy. Appears to be the crash manifestation of #1870.
Steps to Reproduce
- Deploy a Python 3.13 Flex Consumption function app with an async HTTP trigger.
host.json:{ "version": "2.0", "telemetryMode": "OpenTelemetry" }.- Add app setting
PYTHON_ENABLE_OPENTELEMETRY=true. - Call any async function -> HTTP 500 with the AttributeError above.
- Remove
PYTHON_ENABLE_OPENTELEMETRY-> healthy.
Relevant code being tried
host.json: `{ "version": "2.0", "telemetryMode": "OpenTelemetry" }`
App setting: PYTHON_ENABLE_OPENTELEMETRY=true
(App also calls azure.monitor.opentelemetry.configure_azure_monitor(...) at startup; removing that call does not change the crash.)
Relevant log output
AttributeError: 'NoneType' object has no attribute 'extract'
File ".../azure_functions_runtime/otel.py", line ~112, in configure_opentelemetry
ctx = otel_manager.get_trace_context_propagator().extract(carrier)
requirements.txt file
azure-functions
azure-functions-durable
azure-monitor-opentelemetry
Where are you facing this problem?
Production Environment (explain below)
Function app name
No response
Additional Information
Hosting: Azure Functions Flex Consumption (FC1), Python 3.13, v2 azure_functions_runtime.
Related:
#1870 (worker-side auto-init gap),
#1626 (late context propagation).
Suggested fix: call update_opentelemetry_status() in the PYTHON_ENABLE_OPENTELEMETRY branch of worker_init (symmetric to the App Insights path), and/or add a None guard in configure_opentelemetry() .
- Dominant language
- Python
- Stars
- 357
- Forks
- 116
- Avg merge
- 32m
- Merged PRs (30d)
- 1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Azure/azure-functions-python-worker
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 5/5 Over a week Newbie friendliness 28/100
Azure/azure-functions-python-worker#1908 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
Azure/azure-functions-python-worker#1906 · 1 comment ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
All issues in Azure/azure-functions-python-worker
Similar issues
-
triage/confirmed
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
agentscope-ai/agentscope#2775 ·
-
comp/desktop P3 type/bug
Difficulty 1/5 Under an hour Newbie friendliness 92/100
NousResearch/hermes-agent#118866 ·
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 90/100
apache/cloudstack#14222 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100