Skip to content

firebase login --no-localhost fails with "Premature close" on macOS Tahoe (fresh install, multiple Node versions tested) #10692

@cuidagoargentina-cmd

Description

@cuidagoargentina-cmd

[REQUIRED] Environment info

firebase-tools: 15.22.0 (also reproduced on 13.31.2)
Platform: macOS Tahoe (fresh clean install, no migration/backup)
Node.js: v24.17.0 and v22.23.0 (both tested, same result)

[REQUIRED] Test case

Run firebase login --no-localhost and attempt to complete authentication with a valid authorization code from the browser flow.

[REQUIRED] Steps to reproduce

  1. Run firebase login --no-localhost
  2. Decline Gemini/telemetry prompts
  3. Open the provided URL in browser, sign in with Google account, copy the authorization code
  4. Paste the code into the CLI prompt immediately (within seconds)
  5. Authentication fails

Expected behavior

Login should succeed and credentials should be stored.

Actual behavior

Authentication Error: Your credentials are no longer valid. Please run firebase login --reauth

Error: Unable to authenticate using the provided code. Please try again.

With --debug flag, the underlying error is:
Token Fetch Error: FirebaseError: FetchError: Invalid response body while trying to fetch https://accounts.google.com/o/oauth2/token: Premature close

at RetryOperation._fn (/usr/local/lib/node_modules/firebase-tools/lib/apiv2.js:317:88)

Troubleshooting already performed

  • Reproduced on 2 separate Macs (one fresh format, one with prior working installs)
  • Reproduced with 2 different Google accounts
  • Reproduced with firebase-tools 15.22.0 and 13.31.2
  • Reproduced with Node v24.17.0 and v22.23.0
  • Reproduced with --no-localhost and default localhost callback flow
  • Reproduced across 2 different networks (home WiFi, mobile hotspot)
  • IPv6 disabled — no change
  • macOS firewall disabled — no change
  • No VPN, proxy, MDM profile, or Little Snitch present
  • DNS cache flushed — no change
  • Verified Node can successfully complete other HTTPS POST requests to Google APIs (oauth2.googleapis.com) outside the CLI's exact flow — those succeed and return complete responses
  • Verified Node can successfully run a local HTTP server and receive connections on 127.0.0.1 (loopback works fine)
  • The failure appears specific to the exact request/response Firebase CLI's apiv2.js makes during the OAuth token exchange, not to networking, DNS, or Node's general HTTPS/HTTP capabilities

This strongly suggests a compatibility issue between firebase-tools' HTTP client (apiv2.js) and macOS Tahoe's networking stack, though I was not able to isolate the exact mechanism.

Related: I found a similar report at #10681 with the same Node version pairing (15.21.0 / Node 24.17.0) on Windows, suggesting this may not be macOS-exclusive.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions