Skip to content

Long running task failing because of JWT token expiration #58775

Closed

Description

@vincbeck

Apache Airflow version

main (development)

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

No response

What happened?

If you have a task running more than [execution_api] jwt_expiration_time (by default 10 minutes), the task fails because the JWT token expires without getting refreshed.

jwt.exceptions.ExpiredSignatureError: Signature has expired

What you think should happen instead?

The token should be refreshed before the token expires, it was working as such before but #58524 introduced this bug.

How to reproduce

Have a task that takes more than [execution_api] jwt_expiration_time. It will fail before it completes.

Operating System

Macos

Versions of Apache Airflow Providers

No response

Deployment

Other

Deployment details

No response

Anything else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Activity

  1. added
    kind:bug
    needs-triage
    and removed
    needs-triage
    on Nov 27, 2025
  2. added
    area:API
    on Nov 27, 2025
  3. pierrejeambrun commented on Nov 27, 2025

    @pierrejeambrun
    Member

    Maybe we need to mark Depends(JWTReissuer(), scope="function") too for JWTRefresherDep.

    Otherwise this piece of code is done after the response is returned, and therefore the header is not set. That's because of the new way fastapi handles the dependency teardown.

  4. pierrejeambrun commented on Nov 27, 2025

    @pierrejeambrun
    Member

    I'll test this in a bit and report back

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:APIarea:autharea:corekind:bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions