Skip to content

Conversation

@pierrejeambrun
Copy link
Member

@pierrejeambrun pierrejeambrun commented Nov 20, 2025

Cadwyn was fixed (zmievsa/cadwyn#305) and doesn't prevent us from upgrading to fastapi >= 0.121.0 anymore to benefit from the recently added scope feature for dependencies. (fastapi/fastapi#14262)

@pierrejeambrun pierrejeambrun added this to the Airflow 3.2.0 milestone Nov 20, 2025
@pierrejeambrun
Copy link
Member Author

pierrejeambrun commented Nov 20, 2025

Marked for 3.2.0, forcing people to go for fastapi>=0.121.0 probably shouldn't be hidden in a patch release. (I might as well add a significant newsfragment ?)

@pierrejeambrun pierrejeambrun changed the title Remove fastapi upper constraint Remove FastAPI upper constraint Nov 20, 2025
@potiuk
Copy link
Member

potiuk commented Nov 22, 2025

Marked for 3.2.0, forcing people to go for fastapi>=0.121.0 probably shouldn't be hidden in a patch release. (I might as well add a significant newsfragment ?)

Good idea.

@bugraoz93
Copy link
Contributor

Good idea to have a newsfragment about it

Copy link
Contributor

@amoghrajesh amoghrajesh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good.

@pierrejeambrun pierrejeambrun merged commit 1b69248 into apache:main Nov 24, 2025
121 checks passed
@pierrejeambrun pierrejeambrun deleted the remove-fastapi-uppder-constraint branch November 24, 2025 13:34
@vincbeck
Copy link
Contributor

This PR makes any task taking more than [execution_api] jwt_expiration_time (by default 10 minutes) fail because the JWT token expires without getting refreshed. Though, I do not know why.

@ashb
Copy link
Member

ashb commented Nov 26, 2025

@vincbeck That's.... super odd. The way the token renewal was working is that when the token was checked in the dep, if it was found to have less than 20% of the total validity left, a new one was generated and put in a specially named header

# Defined as a "mapping type", but 99.9% of the time it's a mutable dict. We catch
# errors if not
val.headers["Refreshed-API-Token"] = new # type: ignore[index]

Perhaps that "Defined as a "mapping type", but 99.9% of the time it's a mutable dict" is no longer true.

Oh, it should hit

response.headers["Refreshed-API-Token"] = new
first.

Either way, do you see anything in your logs about "Error refreshing Task JWT"?

@vincbeck
Copy link
Contributor

Either way, do you see anything in your logs about "Error refreshing Task JWT"?

Nop, I only see jwt.exceptions.ExpiredSignatureError: Signature has expired and the task fails.

Given the significant written by Pierre:

FastAPI dependency is updated and lower bound set to ``0.121.0``

Airflow now requires FastAPI ``>=0.121.0`` and removes the previous upper
constraint. This aligns with FastAPI's new dependency lifecycle scopes
(e.g. request/function) that change how dependencies with ``yield`` are
exited.
See `FastAPI PR #14262 <https://github.com/fastapi/fastapi/pull/14262>`_.

I would say it is probably due to the fastapi upgrade because I can see in JWTReissuer that we do:

        try:
            yield
        finally:
            ...

@vincbeck
Copy link
Contributor

Created an issue: #58775

Copilot AI pushed a commit to jason810496/airflow that referenced this pull request Dec 5, 2025
* Remove fastapi upper constraint

* Fix CI

* Fix CI

* Add newsfragment
itayweb pushed a commit to itayweb/airflow that referenced this pull request Dec 6, 2025
* Remove fastapi upper constraint

* Fix CI

* Fix CI

* Add newsfragment
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.

6 participants