Skip to content

Conversation

@amoghrajesh
Copy link
Contributor

Fastapi 0.118 introduces a breaking change that breaks our CI: https://github.com/apache/airflow/actions/runs/18116283428

  • Previously (≤0.117), the yield dependency cleanup code (e.g., closing a create_session context manager in _get_session) ran before the response was sent.
  • In 0.118.0+, the cleanup now runs after the response starts streaming.
  • This means exceptions (like duplicate entity errors when the DB session commits implicitly) are raised too late → response has already started, so FastAPI can’t change the status code ("Caught handled exception, but response already started.").

Next steps is to raising this with Sebastián (FastAPI maintainer) since this was an intentional change to support streaming responses, and he has signaled awareness that it could cause issues and synchronise and resolve the issue.

related: https://www.linkedin.com/posts/tiangolo_advanced-dependencies-fastapi-activity-7378282080457187328-ZTT_?utm_source=share&utm_medium=member_desktop&rcm=ACoAAAAbPJABWNiWtLGbVPUKL8PDTSlmqJVvFTs


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in airflow-core/newsfragments.

@amoghrajesh
Copy link
Contributor Author

Mypy issue fixed by #56244

@amoghrajesh amoghrajesh merged commit 0931482 into apache:main Sep 30, 2025
91 checks passed
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 1, 2025
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 2, 2025
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 3, 2025
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 4, 2025
jscheffl pushed a commit to jscheffl/airflow that referenced this pull request Oct 4, 2025
jscheffl added a commit that referenced this pull request Oct 4, 2025
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 5, 2025
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 5, 2025
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 7, 2025
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 8, 2025
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 9, 2025
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 10, 2025
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 11, 2025
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 12, 2025
dabla pushed a commit to dabla/airflow that referenced this pull request Oct 12, 2025
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 14, 2025
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 15, 2025
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 17, 2025
abdulrahman305 bot pushed a commit to abdulrahman305/airflow that referenced this pull request Oct 19, 2025
@jamie-albert
Copy link

Greetings, if I may leave this here to make the path easier for those who follow

  1. Upstream discussion: [0.118.0] Use case for early closing in yield dependencies (session commit before response) fastapi/fastapi#14151

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants