I'm working on AWS EC2. I created a virtual environment and installed all the necessary dependencies. I connected to it via VSCode, and when I try to start the server using the airflow standalone command, I get the following error multiple times:
api-server | /home/ubuntu/airflow_snow_venv/lib/python3.12/site-packages/airflow/api_fastapi/execution_api/routes/init.py:23 DeprecationWarning: 'HTTP_422_UNPROCESSABLE_ENTITY' is deprecated. Use 'HTTP_422_UNPROCESSABLE_CONTENT' instead.
How can I resolve this issue?
It's a warning, not an error, so you should hopefully be able to run your system in any case.
The issue is that RFC 9110 introduced HTTP_422_UNPROCESSABLE_CONTENT and deprecated HTTP_422_UNPROCESSABLE_ENTITY.
Starlette is an ASGI framework/toolkit which FastAPI uses and they adopted RFC 9110 in version 0.48.0 (ref).
FastAPI re-exports status codes directly from Starlette (ref) so this has affected FastAPI.
This has been addressed by an apache-airflow PR within the last couple of days, but this hasn't yet made it into a new release.
For now, either live with the warnings, or you can try downgrading Starlette. FastAPI 0.119.0 supports starlette<0.49.0,>=0.40.0 so you could eliminating the warning by pinning Starlette to an earlier version until that PR is implemented in a new relased of apache-airflow, such as:
pip install starlette==0.47.3