Repository navigation
Description
[REQUIRED] Environment info
firebase-tools: 15.22.3 and later (reproduced with 15.37.0)
Platform: Linux (Debian trixie container), Node v24.22.3
[REQUIRED] Test case
CI runner without direct internet access; egress only through an HTTP proxy set via HTTPS_PROXY/https_proxy (and NODE_USE_ENV_PROXY=1). Authentication with a service account via GOOGLE_APPLICATION_CREDENTIALS (e.g. FirebaseExtended/action-hosting-deploy).
[REQUIRED] Steps to reproduce
export HTTPS_PROXY=http://proxy.example:8888 # the only way out
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json
npx [email protected] projects:list[REQUIRED] Expected behavior
The OAuth token request (https://oauth2.googleapis.com/token / www.googleapis.com/oauth2/v4/token) goes through HTTPS_PROXY, as it does up to 15.22.2.
[REQUIRED] Actual behavior
The CLI hangs after > command requires scopes: [...] and fails after several minutes with request to https://www.googleapis.com/oauth2/v4/token failed. /proc/net/tcp shows a direct SYN_SENT to a Google IP on 443 instead of a connection to the proxy.
Cause: #10717 (commit 2ad25cf) sets clientOptions.transporterOptions.agent = apiv2.noKeepAliveAgent in getAuthClient() (src/requireAuth.ts). gaxios uses a caller-supplied agent as is and skips its HTTPS_PROXY handling, and Node does not apply NODE_USE_ENV_PROXY to custom https.Agent instances either. So every token request bypasses the proxy.
Minimal reproduction with the same libraries (hangs; without the agent option the token request goes through the proxy in ~100 ms):
const https = require("https"), http = require("http");
const { GoogleAuth } = require("google-auth-library");
const ag = new https.Agent({ keepAlive: false }), hg = new http.Agent({ keepAlive: false });
new GoogleAuth({
scopes: ["https://www.googleapis.com/auth/cloud-platform"],
clientOptions: { transporterOptions: { agent: (u) => (u.protocol === "https:" ? ag : hg) } },
}).getClient().then((c) => c.getAccessToken()).then(console.log, console.error);Suggested fix: only set the no-keep-alive agent when no proxy is configured, i.e. if (!proxyURIFromEnv()) in getAuthClient() – the premature-close retry in apiv2.ts already skips its no-keep-alive agent when a proxy is set.
Same proxy-only container, fake service-account key: 15.22.2 reaches the token endpoint through the proxy and fails after 1 s with invalid_grant (expected); 15.22.3 hangs after command requires scopes until killed.
Workaround: pin [email protected].
Activity