dheerajturaga opened a new issue, #49229:
URL: https://github.com/apache/airflow/issues/49229
### Apache Airflow version
3.0.0
### If "Other Airflow 2 version" selected, which one?
_No response_
### What happened?
Relates to: #49013
When using AIRFLOW__CORE__AUTH_MANAGER:
airflow.providers.fab.auth_manager.fab_auth_manager.FabAuthManager in a default
setup (undefined api.base_url) api server errors out with
```
airflow-apiserver-1 | INFO: 172.18.0.1:57946 - "POST /auth/login/
HTTP/1.1" 302 Found
airflow-apiserver-1 | [2025-04-14T13:03:03.312+0000]
{configuration.py:1068} WARNING - section/key [api/base_url] not found in config
airflow-apiserver-1 | [2025-04-14T13:03:03.312+0000] {app.py:1744} ERROR -
Exception on / [GET]
airflow-apiserver-1 | Traceback (most recent call last):
airflow-apiserver-1 | File
"/home/airflow/.local/lib/python3.12/site-packages/flask/app.py", line 2529, in
wsgi_app
airflow-apiserver-1 | response = self.full_dispatch_request()
airflow-apiserver-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
airflow-apiserver-1 | File
"/home/airflow/.local/lib/python3.12/site-packages/flask/app.py", line 1825, in
full_dispatch_request
airflow-apiserver-1 | rv = self.handle_user_exception(e)
airflow-apiserver-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
airflow-apiserver-1 | File
"/home/airflow/.local/lib/python3.12/site-packages/flask/app.py", line 1823, in
full_dispatch_request
airflow-apiserver-1 | rv = self.dispatch_request()
airflow-apiserver-1 | ^^^^^^^^^^^^^^^^^^^^^^^
airflow-apiserver-1 | File
"/home/airflow/.local/lib/python3.12/site-packages/flask/app.py", line 1799, in
dispatch_request
airflow-apiserver-1 | return
self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
airflow-apiserver-1 |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
airflow-apiserver-1 | File
"/home/airflow/.local/lib/python3.12/site-packages/airflow/providers/fab/www/views.py",
line 71, in index
airflow-apiserver-1 | response =
make_response(redirect(f"{conf.get('api', 'base_url')}", code=302))
airflow-apiserver-1 |
^^^^^^^^^^^^^^^^^^^^^^^^^^^
airflow-apiserver-1 | File
"/home/airflow/.local/lib/python3.12/site-packages/airflow/configuration.py",
line 1070, in get
airflow-apiserver-1 | raise AirflowConfigException(f"section/key
[{section}/{key}] not found in config")
airflow-apiserver-1 | airflow.exceptions.AirflowConfigException:
section/key [api/base_url] not found in config
airflow-apiserver-1 | INFO: 172.18.0.1:57946 - "GET /auth/ HTTP/1.1"
500 Internal Server Error
```
### What you think should happen instead?
`conf.get('api', 'base_url')` should include fallback `conf.get('api',
'base_url', fallback="/")`
However, I tried this and it still hits the issue. I also tried changing
this to `str(request.base_url)` however, that results in an infinite redirect
to `<base_url>/auth`
### How to reproduce
Here's a stripped down docker-compose to reproduce the issue. Just login on
the webserver
```
---
x-airflow-common:
&airflow-common
# In order to add custom dependencies or upgrade provider distributions
you can use your extended image.
# Comment the image line, place your Dockerfile in the directory where you
placed the docker-compose.yaml
# and uncomment the "build" line below, Then run `docker-compose build` to
build the images.
image: apache/airflow:3.0.0rc2
# build: .
environment:
&airflow-common-env
AIRFLOW__CORE__EXECUTOR: LocalExecutor
AIRFLOW__CORE__AUTH_MANAGER:
airflow.providers.fab.auth_manager.fab_auth_manager.FabAuthManager
AIRFLOW__DATABASE__SQL_ALCHEMY_CONN:
postgresql+psycopg2://airflow:airflow@postgres/airflow
AIRFLOW__CELERY__RESULT_BACKEND:
db+postgresql://airflow:airflow@postgres/airflow
AIRFLOW__CELERY__BROKER_URL: redis://:@redis:6379/0
AIRFLOW__CORE__FERNET_KEY: ''
AIRFLOW__CORE__DAGS_ARE_PAUSED_AT_CREATION: 'true'
AIRFLOW__CORE__LOAD_EXAMPLES: 'false'
AIRFLOW__CORE__EXECUTION_API_SERVER_URL:
'http://airflow-apiserver:8080/execution/'
# yamllint disable rule:line-length
# Use simple http server on scheduler for health checks
# See
https://airflow.apache.org/docs/apache-airflow/stable/administration-and-deployment/logging-monitoring/check-health.html#scheduler-health-check-server
# yamllint enable rule:line-length
AIRFLOW__SCHEDULER__ENABLE_HEALTH_CHECK: 'true'
# WARNING: Use _PIP_ADDITIONAL_REQUIREMENTS option ONLY for a quick
checks
# for other purpose (development, test and especially production usage)
build/extend Airflow image.
_PIP_ADDITIONAL_REQUIREMENTS: ${_PIP_ADDITIONAL_REQUIREMENTS:-}
# The following line can be used to set a custom config file, stored in
the local config folder
# If you want to use it, outcomment it and replace airflow.cfg with the
name of your config file
# AIRFLOW_CONFIG: '/opt/airflow/config/airflow.cfg'
depends_on:
&airflow-common-depends-on
postgres:
condition: service_healthy
services:
postgres:
image: postgres:13
environment:
POSTGRES_USER: airflow
POSTGRES_PASSWORD: airflow
POSTGRES_DB: airflow
healthcheck:
test: ["CMD", "pg_isready", "-U", "airflow"]
interval: 10s
retries: 5
start_period: 5s
restart: always
airflow-apiserver:
<<: *airflow-common
command: api-server
ports:
- "8080:8080"
healthcheck:
test: ["CMD", "curl", "--fail", "http://localhost:8080/api/v2/version"]
interval: 30s
timeout: 10s
retries: 5
start_period: 30s
restart: always
depends_on:
<<: *airflow-common-depends-on
airflow-init:
condition: service_completed_successfully
user: "0:0"
airflow-init:
<<: *airflow-common
entrypoint: /bin/bash
# yamllint disable rule:line-length
command:
- -c
- |
mkdir -p /sources/logs /sources/dags /sources/plugins
exec /entrypoint airflow version
# yamllint enable rule:line-length
environment:
<<: *airflow-common-env
_AIRFLOW_DB_MIGRATE: 'true'
_AIRFLOW_WWW_USER_CREATE: 'true'
_AIRFLOW_WWW_USER_USERNAME: ${_AIRFLOW_WWW_USER_USERNAME:-airflow}
_AIRFLOW_WWW_USER_PASSWORD: ${_AIRFLOW_WWW_USER_PASSWORD:-airflow}
_PIP_ADDITIONAL_REQUIREMENTS: ''
user: "0:0"
volumes:
postgres-db-volume:
```
You may also need to add a dummy user with:
```
airflow users create -u airflow_user -p airflow_user --email
[email protected] --role Admin -f Airflow -l Admin
```
### Operating System
Ubuntu 24.04 (WSL)
### Versions of Apache Airflow Providers
_No response_
### Deployment
Docker-Compose
### Deployment details
_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)
--
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]