Pass credentials object to GCSFileSystem for automatic token refresh#62013
Merged
Conversation
Previously, get_fs() extracted a static access token string via _get_access_token() and passed it to GCSFileSystem. This token expires after ~1 hour with no way to refresh, causing 401 errors in long-running tasks. By passing the Credentials object directly, gcsfs can automatically refresh the token before each request via its built-in maybe_refresh() mechanism.
potiuk
approved these changes
Feb 16, 2026
shahar1
approved these changes
Feb 16, 2026
choo121600
pushed a commit
to choo121600/airflow
that referenced
this pull request
Feb 22, 2026
Subham-KRLX
pushed a commit
to Subham-KRLX/airflow
that referenced
this pull request
Mar 4, 2026
dominikhei
pushed a commit
to dominikhei/airflow
that referenced
this pull request
Mar 11, 2026
Ankurdeewan
pushed a commit
to Ankurdeewan/airflow
that referenced
this pull request
Mar 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously,
get_fs()extracted a static access token string via_get_access_token()and passed it toGCSFileSystem. This token expires after ~1 hour with no way to refresh, causing 401 errors in long-running tasks.By passing the
Credentialsobject directly,gcsfscan automatically refresh the token before each request via its built-inmaybe_refresh()mechanism.This was introduced in #38102 to fix #37834 where
credentials.tokenwasNonebefore manual refresh.discussed on Slack few weeks ago with @shahar1 @potiuk
I have added some mocked basic tests, but not sure how much value they brings. I have tested using following DAG locally also. Before it fails - after it refresh tokens and continue.