Skip to content

Auth regression in 15.22.2: ADC / Workload Identity Federation fails with "Failed to authenticate, have you run firebase login?" #10716

Closed

Description

@bezysoftware

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).
  • Command: firebase deploy --only functions,firestore,storage --project <id> --non-interactive

Repro:

  • In CI, authenticate via WIF so GOOGLE_APPLICATION_CREDENTIALS points at the external_account credentials file.
  • npx [email protected] deploy --only functions --non-interactive → succeeds.
  • npx [email protected] deploy --only functions --non-interactive → Failed to authenticate, have you run firebase login?

Activity

  1. ayanko commented on Jun 25, 2026

    @ayanko

    Same flaky issue with 15.22.1 as well. Some debug:

    [debug] [2026-06-25T11:46:27.518Z] >>> [apiv2][query] GET https://firebase-public.firebaseio.com/cli.json [none]
    [debug] [2026-06-25T11:46:28.411Z] > command requires scopes:
      ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
        [debug] [2026-06-25T11:46:28.541Z] <<< [apiv2][status] GET https://firebase-public.firebaseio.com/cli.json 200
        [debug] [2026-06-25T11:46:28.542Z] <<< [apiv2][body] GET https://firebase-public.firebaseio.com/cli.json {"cloudBuildErrorAfter":1594252800000,"cloudBuildWarnAfter":1590019200000,"de
      faultNode10After":1594252800000,"minVersion":"3.0.5","node8DeploysDisabledAfter":1613390400000,"node8RuntimeDisabledAfter":1615809600000,"node8WarnAfter":1600128000000}
        [debug] [2026-06-25T11:46:29.507Z] Error: Invalid response body while trying to fetch https://sts.googleapis.com/v1/token: Premature close
    
  2. dhruvshettty commented on Jun 25, 2026

    @dhruvshettty

    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).

  3. ayanko commented on Jun 25, 2026

    @ayanko

    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.

      - 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.

  4. aalej commented on Jun 25, 2026

    @aalej
    Contributor

    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.

  5. dhruvshettty commented on Jun 25, 2026

    @dhruvshettty

    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.

  6. ienground commented on Jun 25, 2026

    @ienground

    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...

  7. self-assigned this
    on Jun 25, 2026
  8. joehan commented on Jun 25, 2026

    @joehan
    Member

    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.

  9. added a commit that references this issue on Jun 25, 2026
    83c1013
  10. added a commit that references this issue on Jun 25, 2026
    2ad25cf
  11. nelsondavidmi commented on Jun 26, 2026

    @nelsondavidmi

    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.

      - 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.

    Thanks for that! That is the solution

  12. 9 remaining items

  13. added 2 commits that reference this issue on Jul 9, 2026
    b915075
    b0147b4
  14. added a commit that references this issue on Aug 16, 2026
    fd9670c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions