DhavalGojiya commented on issue #51370:
URL: https://github.com/apache/airflow/issues/51370#issuecomment-5253357957
Still reproducible on **3.0.6** with `FabAuthManager`. Adding
`AIRFLOW__LOGGING__LOGGING_LEVEL=DEBUG` makes `airflow-init` skip admin-user
creation:
```
airflow-init-1 | BrokenPipeError: [Errno 32] Broken pipe
airflow-init-1 | Skipping user creation as auth manager different from Fab
is used
```
Cause: under `set -euo pipefail`, `airflow config get-value core
auth_manager | grep -q "FabAuthManager"` prints ~100 lines at DEBUG, `grep -q`
exits at the match and closes the pipe, so the left side dies with
`BrokenPipeError` and exits 120. `PIPESTATUS` is `120 0`, so grep matched but
`pipefail` fails the check and the `else` branch runs.
```bash
docker run --rm \
-e
AIRFLOW__CORE__AUTH_MANAGER=airflow.providers.fab.auth_manager.fab_auth_manager.FabAuthManager
\
-e AIRFLOW__LOGGING__LOGGING_LEVEL=DEBUG \
--entrypoint bash apache/airflow:3.0.6 -c \
'set -euo pipefail
airflow config get-value core auth_manager | grep -q FabAuthManager
echo "PIPESTATUS: ${PIPESTATUS[@]}"'
```
`ab_user` then stays empty, so a still-valid JWT resolves to `None` and
every UI request returns HTTP 500 instead of an auth error:
<details>
<summary>Full traceback (Airflow 3.0.6)</summary>
```
File
"/home/airflow/.local/lib/python3.12/site-packages/airflow/api_fastapi/core_api/security.py",
line 106, in <lambda>
is_authorized_callback=lambda: get_auth_manager().is_authorized_dag(
File
"/home/airflow/.local/lib/python3.12/site-packages/airflow/providers/fab/auth_manager/fab_auth_manager.py",
line 342, in is_authorized_dag
return self._is_authorized_dag(method=method, details=details, user=user)
File
"/home/airflow/.local/lib/python3.12/site-packages/airflow/providers/fab/auth_manager/fab_auth_manager.py",
line 580, in _is_authorized_dag
authorized_dags = self.get_authorized_dag_ids(user=user, method=method)
File
"/home/airflow/.local/lib/python3.12/site-packages/airflow/providers/fab/auth_manager/fab_auth_manager.py",
line 444, in get_authorized_dag_ids
.where(User.id == user.id)
^^^^^^^
AttributeError: 'NoneType' object has no attribute 'id'
```
</details>
The 500 looks fixed on `main` (`deserialize_user` now raises `ValueError`),
but the entrypoint check is unchanged
<img width="1915" height="940" alt="Image"
src="https://github.com/user-attachments/assets/23a9fe30-93de-439e-88bc-40a5f7fc37f5"
/>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]