Unable to access team-specific connections in top-level DAG code
- Dominant language
- Python
- Stars
- 46.9k
- Forks
- 17.8k
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 472
Description
### Under which category would you file this issue?
Airflow Core
### Apache Airflow version
3.2.0
### What happened and how to reproduce it?
Hi everyone!
We've discovered that team-specific connections in Airflow 3.2 can only be read within the task context of a dag code.
If we try to access **team-specific connections in the top level dag code** processed in the dag-processor, we get the following error visible in the UI:
```
Traceback (most recent call last):
File "/home/airflow/.local/lib/python3.13/site-packages/airflow/sdk/definitions/connection.py", line 250, in get
return _get_connection(conn_id)
File "/home/airflow/.local/lib/python3.13/site-packages/airflow/sdk/execution_time/context.py", line 177, in _get_connection
raise AirflowNotFoundException(f"The conn_id `{conn_id}` isn't defined")
airflow.sdk.exceptions.AirflowNotFoundException: The conn_id `uc_juwels` isn't defined
```
The logs of the dag processor are showing:
```
Connection not found [airflow.sdk.api.client] conn_id=uc_juwels detail={'reason': 'not_found', 'message': 'Connection with ID uc_juwels not found'} loc=client.py:415 status_code=404
```
The message `Connection with ID uc_juwels not found` is missleading as the connections exists but is team-specific. Access to any global connections is possible.
The error gets initiated starting in the dag processors code here: https://github.com/apache/airflow/blob/3.2.0/airflow-core/src/airflow/dag_processing/processor.py#L565
Our initial thought was that we needed to start a bundle-specific DAG processor with `--bundle-name`.
However, we still see the same errors even with that.
### What you think should happen instead?
We would have assumed that team-specific connections are accessible in the top level dag code.
We are unsure whether this is a bug, intended behavior or something already planed (e.g. in AIP 92 - Isolate DAG processor)
https://cwiki.apache.org/confluence/display/AIRFLOW/%5BWIP%5D+AIP-92+Isolate+DAG+processor%2C+Callback+processor%2C+and+Triggerer+from+core+services
### Operating System
redhat 9
### Deployment
Docker-Compose
### Apache Airflow Provider(s)
_No response_
### Versions of Apache Airflow Providers
_No response_
### Official Helm Chart version
Not Applicable
### Kubernetes Version
_No response_
### Helm Chart configuration
_No response_
### Docker Image customizations
_No response_
### Anything else?
_No response_
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [x] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
Contributor guide
Assessment
This issue has not been assessed yet.