本地部署Apache Airflow Stable APIs出现404错误求助
Apache Airflow 2.9.3 Stable API 返回404错误的解决办法
问题现象
调用/api/dags?limit=100&only_active=true时返回HTTP 404,请求日志如下:
INFO - 127.0.0.1 - - [10/Aug/2024 22:14:09] "GET /api/dags?limit=100&only_active=true HTTP/1.1" 404 -
Airflow配置的[api]段设置:
[api] enable_experimental_api = False auth_backends = airflow.api.auth.backend.basic_auth,airflow.api.auth.backend.session maximum_page_limit = 100 fallback_page_limit = 100 google_oauth2_audience = google_key_path = access_control_allow_headers = access_control_allow_methods = access_control_allow_origins = enable_xcom_deserialize_support = False
Airflow版本:2.9.3,执行器为SequentialExecutor
问题原因
Airflow 2.x的Stable API路径前缀是/api/v1/,你请求的/api/dags是旧版实验性API的路径。由于配置中enable_experimental_api = False已经禁用了实验性API,所以访问该路径会返回404。
解决步骤
- 修改请求路径为Stable API的正确格式,将原请求改为:
GET /api/v1/dags?limit=100&only_active=true - 验证API可用性:直接访问
/api/v1/,若返回包含各类API端点的JSON数据,说明Stable API已正常启用 - 确认配置:无需修改现有
[api]段配置,Airflow 2.x默认启用Stable API,当前设置符合要求
内容的提问来源于stack exchange,提问作者Abhay Dandekar
相关产品推荐
相关产品推荐

