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
google-gax / gaxios: node-fetch@3 keeps deprecated node-domexception in every install, on Node >=22 where fetch is native #9929
Every @google-cloud/* client built on gax inherits it. For example, we see it through @google-cloud/tasks. Related reports are #7666 (core libraries, via gaxios) and #7221 (BigQuery, via teeny-request). This issue covers the gax and gaxios path specifically, with notes on what a fix involves.
What I found
Both packages already require engines.node >= 22, where fetch, Response, AbortController and DOMException are all built in. Yet:
google-gax uses node-fetch for types only. In core/packages/gax/src, fallbackServiceStub.ts has import type {Response as NodeFetchResponse} from 'node-fetch', and streamArrayParser.ts only mentions node-fetch in comments. The real request goes through gaxios (auth.fetch()). So gax's direct dependency could probably become a devDependency, or be replaced by the global Response type. On its own that does not remove the warning, because of point 2.
gaxios always loads node-fetch on Node.Gaxios.#getFetch() uses window.fetch in browsers and the native fetch in Bun, but on Node it unconditionally runs (await import('node-fetch')).default. That is the runtime consumer keeping node-fetch@3, and therefore fetch-blob and node-domexception, in every install.
Why this is not just a one-line switch to globalThis.fetch
The obvious blocker is proxy and agent support: gaxios passes an agent (for example from https-proxy-agent) that node-fetch understands, but Node's built-in fetch (undici) ignores it. It needs a dispatcher instead, such as undici's ProxyAgent or EnvHttpProxyAgent. There are also behaviour differences already worked around in the code: abort-signal reasons, and res.data configurability.
Possible directions
In gaxios, use the native fetch on Node when no custom agent is set, and keep node-fetch (or an undici dispatcher) only for the agent/proxy path. Making node-fetch an optional peer, or loading it lazily, would let users who don't use proxies drop it.
Or use the native fetch throughout and map agent/proxy settings onto an undici dispatcher.
In google-gax, drop the type-only node-fetch dependency (independent of the above, and low-risk).
Activity
maciejbaba commentedon Nov 23, 2026
Linking related work so this can be triaged alongside it:
node-fetchdependency): fix(gax): remove node-fetch types and dependency #9785 removes it (closes cleanup: finish removing node-fetch types from fallbackServiceStub #7679). It's open and waiting for review.fetchon Node. Look into conditionally using native fetch when we move to Node 20 #7716 is the tracking issue (next major: breaking change).The warning only goes away for good once gaxios stops loading
node-fetch, so #9785 on its own won't remove it.