You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Auth regression in 15.22.2: ADC / Workload Identity Federation fails with "Failed to authenticate, have you run firebase login?" #10716
Version: 15.22.2 (15.22.1 works) Platform: GitHub Actions (ubuntu-latest, Node 24), non-interactive deploy authenticating via Workload Identity Federation. What happened: After 15.22.2 was published (2026-06-24), CI deploys that authenticate via Application Default Credentials began failing with:
Error: Failed to authenticate, have you run firebase login?
Pinning back to 15.22.1 resolves it immediately. No change to our workflow, secrets, or WIF config.
Setup:
google-github-actions/auth@v2 with create_credentials_file: true and export_environment_variables: true, producing an external_account credentials file and exporting GOOGLE_APPLICATION_CREDENTIALS (confirmed set in the job env).
npx [email protected] deploy --only functions --non-interactive → Failed to authenticate, have you run firebase login?
Reacted by Dhruv Shetty, Alden Bansemer, Kenny Meyer, d0lo, Richard Einhorn, Caleb, Ozzie Kirkby, Benji Tusk, Alex Neville, Erick Massa Sprengel and 6 more
Possibly broader than 15.22.2 + WIF — different setup, same generic error, but --debug points at a transport-layer failure.
Our setup (differs from OP):
Auth: service-account key via GOOGLE_APPLICATION_CREDENTIALS (type service_account), not WIF/external_account
GitHub-hosted ubuntu-latest, Node 22
Command: firebase use <alias>
Symptom: same Error: Failed to authenticate, have you run firebase login?
But:
Reproduced on 15.20.0 (not just 15.22.2) → downgrading to 15.22.1 does not help us.
Intermittent: identical config/secret fails several runs in a row, then passes on retry minutes later (heavy on 2026-06-25).
firebase use <alias> --debug reveals the real error under the generic message:
Invalid response body while trying to fetch https://www.googleapis.com/oauth2/v4/token: Premature close
at GoogleToken.#requestToken (.../node_modules/gtoken/build/src/index.js)
at JWT.refreshTokenNoCache (.../node_modules/google-auth-library/build/src/auth/jwtclient.js)
at autoAuth (.../firebase-tools/lib/requireAuth.js)
Error: Failed to authenticate, have you run firebase login?
"Premature close" = the connection to the token endpoint is dropped mid-response (not an invalid_grant body). Looks like a transport/network-layer failure reaching oauth2.googleapis.com/token, surfaced as the generic auth error.
So this may be (a) a separate issue sharing the same message, or (b) the same underlying network flakiness — in which case "15.22.1 good / 15.22.2 bad" could be a version/time coincidence (good version only tested during a good window).
Q for others: does --debug show Premature close on oauth2/v4/token for you too? If so it's broader than 15.22.2 + external_account.
Workaround: retry loop around the auth command (only helps when the bad window is short).
I believe you used setup-node action on CI and it upgraded node implicitly.
So after pining to 24.18.0 I have green builds again.
- name: Setup Node.js
uses: actions/setup-node@v4
with:
# Pinned exact: Node 24.17.0 has an http.Agent regression that makes
# node-fetch (used by firebase-tools' bundled google-auth-library) throw
# "Premature close" on the sts.googleapis.com token exchange, breaking
# WIF-authenticated deploys. Fixed in 24.18.0. A bare '24' is not enough
# — setup-node serves the runner-cached 24.17.0. Bump/relax once newer
# 24.x are uniformly safe. See nodejs/node#63989 (fix: #64004).
node-version: '24.18.0'
Good luck.
Reacted by Nelson David Millan Alvarez and Waffiq Aziz
Reacted by Dhruv Shetty, steveoh, Caleb and Nelson David Millan Alvarez
Hey folks, I'm currently working on reproducing this issue. We have seen similar errors related to Premature close, and it is caused by a Node.js bug in nodejs/node#63989 which affects Node.js 24.17.0. If you are using Node.js 24.17.0, upgrading to 24.18.0 should fix this.
I'm not sure though if the initial report here is related to the Node.js bug since it succeeds with [email protected] but errors on [email protected]. I'll give a heads up to our engineering to see if any of the changes we made between 15.22.1 to 15.22.2 could have caused a bug.
Following up on my earlier comment — confirmed it's the Node.js bug, not firebase-tools.
Root cause is nodejs/node#63989: an http.Agent keep-alive regression shipped in the same security batch as Node 22.23.0 and 24.17.0 (both 2026-06-17). node-fetch (gaxios → google-auth-library → firebase-tools) throws Premature close on reused pooled sockets to *.googleapis.com, surfaced as the generic "Failed to authenticate."
Fix: pin Node to a fixed release — 22.23.1 (for 24.x it's 24.18.0). After pinning node-version: '22.23.1', CI + deploys are green and the runner confirms v22.23.1.
Gotcha for anyone on Node 22: bare node-version: '22' is not enough — setup-node serves the runner-cached 22.23.0. Pin the exact patch.
Reacted by mcoevert, Matthew Callinan, Tomas Bezouska, eduardovallespsd-lgtm, kai-creatordb, Waffiq Aziz, Fareez Iqmal, oli-w, Vincent Kielnhofer and Izyne Gallardo
Reacted by Alden Bansemer, d0lo, Matej Navara, eduardovallespsd-lgtm, Nelson David Millan Alvarez and Dmitrii Frolov
I'm not sure if I should be happy that I'm not the only one with this issue, but thank you for posting this. I'm also getting the same error when deploying on GitHub Actions. I've lost count of how many times I've reissued the OAuth JSON...
Hi all, apologies for the inconvenience here - I've got a potential fix that I'm working to validate now. In the meantime, the best way to avoid this is to pin to a working version of node - either 24.18/24.16, or 22.23.1/22.22.x
Some explanation of what happened here:
As mentioned by @dhruvshettty http.Agent keep-alive regression shipped in Node 22.23.0 and 24.17.0 (and it seems some version of Node 26 as well). This broke node-fetch on those versions, which is used by firebase-tools directly. This was breaking firebase login on 15.22.1, which we addressed in #10697 (which went out in 15.22.2). It is also used indirectly through google-auth-library, which we use for ADC based authentication. I'm working on a similar fix of disabling keep-alive there as well.
As to the inconsistent behavior of what versions this occurs on that y'all are seeing - I suspect that this is a red herring caused by the intermittent nature of this issue - however, I'm currently running a script to try to validate this by comparing behavior across commits.
Reacted by eduardovallespsd-lgtm, Alex Neville, Erick Massa Sprengel, Denys, Waffiq Aziz, Dhruv Shetty and Paulo L.
I believe you used setup-node action on CI and it upgraded node implicitly.
So after pining to 24.18.0 I have green builds again.
- name: Setup Node.js
uses: actions/setup-node@v4
with:
# Pinned exact: Node 24.17.0 has an http.Agent regression that makes
# node-fetch (used by firebase-tools' bundled google-auth-library) throw
# "Premature close" on the sts.googleapis.com token exchange, breaking
# WIF-authenticated deploys. Fixed in 24.18.0. A bare '24' is not enough
# — setup-node serves the runner-cached 24.17.0. Bump/relax once newer
# 24.x are uniformly safe. See nodejs/node#63989 (fix: #64004).
node-version: '24.18.0'
Activity
ayanko commentedon Jun 25, 2026
Same flaky issue with 15.22.1 as well. Some debug:
dhruvshettty commentedon Jun 25, 2026
Possibly broader than 15.22.2 + WIF — different setup, same generic error, but
--debugpoints at a transport-layer failure.Our setup (differs from OP):
GOOGLE_APPLICATION_CREDENTIALS(typeservice_account), not WIF/external_accountubuntu-latest, Node 22firebase use <alias>Symptom: same
Error: Failed to authenticate, have you run firebase login?But:
firebase use <alias> --debugreveals the real error under the generic message:"Premature close" = the connection to the token endpoint is dropped mid-response (not an
invalid_grantbody). Looks like a transport/network-layer failure reachingoauth2.googleapis.com/token, surfaced as the generic auth error.So this may be (a) a separate issue sharing the same message, or (b) the same underlying network flakiness — in which case "15.22.1 good / 15.22.2 bad" could be a version/time coincidence (good version only tested during a good window).
Q for others: does
--debugshowPremature closeonoauth2/v4/tokenfor you too? If so it's broader than 15.22.2 + external_account.Workaround: retry loop around the auth command (only helps when the bad window is short).
ayanko commentedon Jun 25, 2026
Well... Issue is in another repo :)
nodejs/node#63989
I believe you used setup-node action on CI and it upgraded node implicitly.
So after pining to 24.18.0 I have green builds again.
Good luck.
aalej commentedon Jun 25, 2026
Hey folks, I'm currently working on reproducing this issue. We have seen similar errors related to
Premature close, and it is caused by a Node.js bug in nodejs/node#63989 which affects Node.js 24.17.0. If you are using Node.js 24.17.0, upgrading to 24.18.0 should fix this.I'm not sure though if the initial report here is related to the Node.js bug since it succeeds with
[email protected]but errors on[email protected]. I'll give a heads up to our engineering to see if any of the changes we made between 15.22.1 to 15.22.2 could have caused a bug.dhruvshettty commentedon Jun 25, 2026
Following up on my earlier comment — confirmed it's the Node.js bug, not firebase-tools.
Root cause is nodejs/node#63989: an
http.Agentkeep-alive regression shipped in the same security batch as Node 22.23.0 and 24.17.0 (both 2026-06-17).node-fetch(gaxios → google-auth-library → firebase-tools) throwsPremature closeon reused pooled sockets to*.googleapis.com, surfaced as the generic "Failed to authenticate."Fix: pin Node to a fixed release — 22.23.1 (for 24.x it's 24.18.0). After pinning
node-version: '22.23.1', CI + deploys are green and the runner confirmsv22.23.1.Gotcha for anyone on Node 22: bare
node-version: '22'is not enough —setup-nodeserves the runner-cached 22.23.0. Pin the exact patch.ienground commentedon Jun 25, 2026
I'm not sure if I should be happy that I'm not the only one with this issue, but thank you for posting this. I'm also getting the same error when deploying on GitHub Actions. I've lost count of how many times I've reissued the OAuth JSON...
fix: pin firebase-tools to 15.22.1 to avoid auth regression
joehan commentedon Jun 25, 2026
Hi all, apologies for the inconvenience here - I've got a potential fix that I'm working to validate now. In the meantime, the best way to avoid this is to pin to a working version of node - either 24.18/24.16, or 22.23.1/22.22.x
Some explanation of what happened here:
As mentioned by @dhruvshettty http.Agent keep-alive regression shipped in Node 22.23.0 and 24.17.0 (and it seems some version of Node 26 as well). This broke node-fetch on those versions, which is used by
firebase-toolsdirectly. This was breakingfirebase loginon 15.22.1, which we addressed in #10697 (which went out in 15.22.2). It is also used indirectly throughgoogle-auth-library, which we use for ADC based authentication. I'm working on a similar fix of disablingkeep-alivethere as well.As to the inconsistent behavior of what versions this occurs on that y'all are seeing - I suspect that this is a red herring caused by the intermittent nature of this issue - however, I'm currently running a script to try to validate this by comparing behavior across commits.
fix: disable keep-alive on GoogleAuth transporter to avoid Premature …
fix: disable keep-alive on GoogleAuth transporter to avoid Premature …
nelsondavidmi commentedon Jun 26, 2026
Thanks for that! That is the solution
9 remaining items
CI: pin the node24 version to workaround regression in firebase-tools
CI: pin the node24 version to workaround regression in firebase-tools
CI: pin the node24 version to workaround regression in firebase-tools
CI: pin the node24 version to workaround regression in firebase-tools
CI: pin the node24 version to workaround regression in firebase-tools
CI: pin the node24 version to workaround regression in firebase-tools
fix(ci): pin firebase-tools to 15.22.1 to avoid WIF auth regression
ci: pin firebase-tools to 15.22.1 — WIF auth regression in 15.22.2+ (#8…
fix: disable keep-alive on GoogleAuth transporter to avoid Premature …
fix: disable keep-alive on GoogleAuth transporter to avoid Premature …
CI: pin firebase-tools to 15.22.1 so WIF auth works
Downgrade firebase-tools to work around ADC auth regression
Pin firebase-tools to 15.22.1 to keep WIF auth working
fix: disable keep-alive on GoogleAuth transporter to avoid Premature …
fix(ci): fix mobile-distribute auth (firebase-tools regression + ADC …