Skip to content

Error docker compose setuo fails with "jwt_secret must be set" #49992

@Lee2532

Description

@Lee2532

Apache Airflow version

3.0.0

If "Other Airflow 2 version" selected, which one?

No response

What happened?

2025-04-30 10:58:11 ERROR: Traceback (most recent call last):
2025-04-30 10:58:11 File "/home/airflow/.local/lib/python3.12/site-packages/starlette/routing.py", line 692, in lifespan
2025-04-30 10:58:11 async with self.lifespan_context(app) as maybe_state:
2025-04-30 10:58:11 ^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-04-30 10:58:11 File "/usr/local/lib/python3.12/contextlib.py", line 210, in aenter
2025-04-30 10:58:11 return await anext(self.gen)
2025-04-30 10:58:11 ^^^^^^^^^^^^^^^^^^^^^
2025-04-30 10:58:11 File "/home/airflow/.local/lib/python3.12/site-packages/fastapi/routing.py", line 133, in merged_lifespan
2025-04-30 10:58:11 async with original_context(app) as maybe_original_state:
2025-04-30 10:58:11 ^^^^^^^^^^^^^^^^^^^^^
2025-04-30 10:58:11 File "/usr/local/lib/python3.12/contextlib.py", line 210, in aenter
2025-04-30 10:58:11 return await anext(self.gen)
2025-04-30 10:58:11 ^^^^^^^^^^^^^^^^^^^^^
2025-04-30 10:58:11 File "/home/airflow/.local/lib/python3.12/site-packages/fastapi/routing.py", line 133, in merged_lifespan
2025-04-30 10:58:11 async with original_context(app) as maybe_original_state:
2025-04-30 10:58:11 ^^^^^^^^^^^^^^^^^^^^^
2025-04-30 10:58:11 File "/usr/local/lib/python3.12/contextlib.py", line 210, in aenter
2025-04-30 10:58:11 return await anext(self.gen)
2025-04-30 10:58:11 ^^^^^^^^^^^^^^^^^^^^^
2025-04-30 10:58:11 File "/home/airflow/.local/lib/python3.12/site-packages/airflow/api_fastapi/app.py", line 62, in lifespan
2025-04-30 10:58:11 await stack.enter_async_context(
2025-04-30 10:58:11 File "/usr/local/lib/python3.12/contextlib.py", line 659, in enter_async_context
2025-04-30 10:58:11 result = await _enter(cm)
2025-04-30 10:58:11 ^^^^^^^^^^^^^^^^
2025-04-30 10:58:11 File "/usr/local/lib/python3.12/contextlib.py", line 210, in aenter
2025-04-30 10:58:11 return await anext(self.gen)
2025-04-30 10:58:11 ^^^^^^^^^^^^^^^^^^^^^
2025-04-30 10:58:11 File "/home/airflow/.local/lib/python3.12/site-packages/fastapi/routing.py", line 133, in merged_lifespan
2025-04-30 10:58:11 async with original_context(app) as maybe_original_state:
2025-04-30 10:58:11 ^^^^^^^^^^^^^^^^^^^^^
2025-04-30 10:58:11 File "/usr/local/lib/python3.12/contextlib.py", line 210, in aenter
2025-04-30 10:58:11 return await anext(self.gen)
2025-04-30 10:58:11 ^^^^^^^^^^^^^^^^^^^^^
2025-04-30 10:58:11 File "/home/airflow/.local/lib/python3.12/site-packages/svcs/fastapi.py", line 66, in call
2025-04-30 10:58:11 async with self.registry, cm(app, self.registry) as state:
2025-04-30 10:58:11 ^^^^^^^^^^^^^^^^^^^^^^
2025-04-30 10:58:11 File "/usr/local/lib/python3.12/contextlib.py", line 210, in aenter
2025-04-30 10:58:11 return await anext(self.gen)
2025-04-30 10:58:11 ^^^^^^^^^^^^^^^^^^^^^
2025-04-30 10:58:11 File "/home/airflow/.local/lib/python3.12/site-packages/airflow/api_fastapi/execution_api/app.py", line 93, in lifespan
2025-04-30 10:58:11 registry.register_value(JWTValidator, _jwt_validator(), ping=JWTValidator.status)
2025-04-30 10:58:11 ^^^^^^^^^^^^^^^^
2025-04-30 10:58:11 File "/home/airflow/.local/lib/python3.12/site-packages/airflow/api_fastapi/execution_api/app.py", line 64, in _jwt_validator
2025-04-30 10:58:11 **get_sig_validation_args(make_secret_key_if_needed=False),
2025-04-30 10:58:11 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-04-30 10:58:11 File "/home/airflow/.local/lib/python3.12/site-packages/airflow/api_fastapi/auth/tokens.py", line 578, in get_sig_validation_args
2025-04-30 10:58:11 return {"secret_key": get_signing_key("api_auth", "jwt_secret", make_secret_key_if_needed)}
2025-04-30 10:58:11 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-04-30 10:58:11 File "/home/airflow/.local/lib/python3.12/site-packages/airflow/api_fastapi/auth/tokens.py", line 535, in get_signing_key
2025-04-30 10:58:11 raise ValueError(f"The value {section}/{key} must be set!")
2025-04-30 10:58:11 ValueError: The value api_auth/jwt_secret must be set!
2025-04-30 10:58:11

What you think should happen instead?

It should operate normally when a simple docker compose up is performed.

How to reproduce

curl -LfO 'https://airflow.apache.org/docs/apache-airflow/3.0.0/docker-compose.yaml'

docker compose up -d

Operating System

macOS

Versions of Apache Airflow Providers

No response

Deployment

Docker-Compose

Deployment details

Docker Compose version v2.17.3

Anything else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:APIAirflow's REST/HTTP APIarea:corekind:bugThis is a clearly a bugneeds-triagelabel for new issues that we didn't triage yetpriority:highHigh priority bug that should be patched quickly but does not require immediate new release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions