Summary
google-vertex provider broken on Node 25+ — @google/genai crashes with Cannot convert undefined or null to object on startup, and ADC credential marker leaks to downstream causing auth failures.
Bug type
Behavior bug (incorrect output/state without crash)
Beta release blocker
No
Steps to reproduce
Bug 1 — node-fetch crash (Node 25+):
- Run OpenClaw on Node v25.x (macOS).
- Attempt any
google-vertex request (e.g. gv-flash model).
- Observe crash:
Cannot convert undefined or null to object thrown from inside @google/genai/node_modules/gaxios.
Bug 2 — ADC marker leak:
- Configure
google-vertex provider with Application Default Credentials (ADC) in ~/.openclaw/.env.
- Start gateway via LaunchAgent.
- Attempt any
google-vertex request.
- Observe auth failure —
x-goog-api-key header being constructed from the raw ADC marker string instead of being omitted.
Expected behavior
Bug 1: google-vertex requests work on Node 25+ without crashing — gaxios should use globalThis.fetch when available.
Bug 2: With valid ADC credentials, google-vertex requests succeed and the pi-ai provider passes vertexai: true to GoogleGenAI so requests go to the Vertex AI endpoint.
Actual behavior
Bug 1: @google/genai's nested gaxios dynamically imports node-fetch on Node 25+, which throws before any request is made.
Bug 2: model-auth-env returns the raw GCP_VERTEX_CREDENTIALS_MARKER constant instead of a resolved sentinel; gemini-auth helpers attempt to build x-goog-api-key from it; pi-ai does not set vertexai: true so even valid ADC requests go to the wrong endpoint.
OpenClaw version
latest (installed via npm global, /opt/homebrew/lib/node_modules/openclaw)
Operating system
macOS 25.x (arm64)
Install method
npm global
Model
google-vertex (effective model e.g. gemini-3.1-flash-lite-preview via Vertex AI)
Provider / routing chain
openclaw -> google-vertex (direct, ADC auth)
Additional provider/model setup details
Two separate patches were developed to work around both bugs locally.
Patch 1 — patch-vertex-node25-fetch.sh patches gaxios to prefer globalThis.fetch over node-fetch:
// Changed from:
static async #getFetch() {
const hasWindow = typeof window !== "undefined" && !!window;
this.#fetch ||= hasWindow
? window.fetch
: (await import("node-fetch")).default;
return this.#fetch;
}
// To:
static async #getFetch() {
const hasWindow = typeof window !== "undefined" && !!window;
const hasGlobalFetch = typeof globalThis.fetch === "function";
this.#fetch ||= hasWindow
? window.fetch
: hasGlobalFetch
? globalThis.fetch.bind(globalThis)
: (await import("node-fetch")).default;
return this.#fetch;
}
Patch 2 — patch-vertex-adc.updated.sh patches:
model-auth-env-*.js: returns "<authenticated>" instead of raw marker constant
gemini-auth-*.js: guards against placeholder strings in parseGeminiAuth
pi-ai/dist/providers/google.js: sets vertexai: true + project/location when provider is google-vertex
~/.openclaw/.env and LaunchAgent plist: writes GOOGLE_CLOUD_PROJECT, GOOGLE_CLOUD_LOCATION
Logs, screenshots, and evidence
Bug 1 — node-fetch crash on Node 25:
$ node -e "import('@google/genai').then(async ({GoogleGenAI}) => { ... })"
Error: Cannot convert undefined or null to object
at node-fetch/index.js:...
Bug 2 — ADC marker leak in gateway logs:
[model-auth-env] resolved=undefined source=gcloud-adc
# downstream receives GCP_VERTEX_CREDENTIALS_MARKER and fails
Impact and severity
Affected: Users of google-vertex provider on Node 25+ (latest macOS default)
Severity: High — provider completely unusable on current Node version
Frequency: 100% (always fails on Node 25+)
Consequence: google-vertex requests crash; no workaround without patching
Additional information
Root causes:
gaxios inside @google/genai uses import("node-fetch") fallback unconditionally — Node 18+ has native globalThis.fetch but gaxios does not check for it.
model-auth-env exposes internal credential marker constant to downstream consumers instead of a resolved sentinel value.
pi-ai google provider does not detect google-vertex provider mode and fails to set vertexai: true on GoogleGenAI.
- LaunchAgent plist
EnvironmentVariables and OPENCLAW_SERVICE_MANAGED_ENV_KEYS drift apart on restart.
Temporary workaround: run the two local patch scripts at ~/gcDora/scripts/patch-vertex-adc.updated.sh and ~/gcDora/scripts/patch-vertex-node25-fetch.sh after each OpenClaw upgrade.
Summary
google-vertex provider broken on Node 25+ —
@google/genaicrashes withCannot convert undefined or null to objecton startup, and ADC credential marker leaks to downstream causing auth failures.Bug type
Behavior bug (incorrect output/state without crash)
Beta release blocker
No
Steps to reproduce
Bug 1 — node-fetch crash (Node 25+):
google-vertexrequest (e.g.gv-flashmodel).Cannot convert undefined or null to objectthrown from inside@google/genai/node_modules/gaxios.Bug 2 — ADC marker leak:
google-vertexprovider with Application Default Credentials (ADC) in~/.openclaw/.env.google-vertexrequest.x-goog-api-keyheader being constructed from the raw ADC marker string instead of being omitted.Expected behavior
Bug 1:
google-vertexrequests work on Node 25+ without crashing —gaxiosshould useglobalThis.fetchwhen available.Bug 2: With valid ADC credentials,
google-vertexrequests succeed and thepi-aiprovider passesvertexai: truetoGoogleGenAIso requests go to the Vertex AI endpoint.Actual behavior
Bug 1:
@google/genai's nestedgaxiosdynamically importsnode-fetchon Node 25+, which throws before any request is made.Bug 2:
model-auth-envreturns the rawGCP_VERTEX_CREDENTIALS_MARKERconstant instead of a resolved sentinel;gemini-authhelpers attempt to buildx-goog-api-keyfrom it;pi-aidoes not setvertexai: trueso even valid ADC requests go to the wrong endpoint.OpenClaw version
latest (installed via npm global,
/opt/homebrew/lib/node_modules/openclaw)Operating system
macOS 25.x (arm64)
Install method
npm global
Model
google-vertex(effective model e.g.gemini-3.1-flash-lite-previewvia Vertex AI)Provider / routing chain
openclaw -> google-vertex(direct, ADC auth)Additional provider/model setup details
Two separate patches were developed to work around both bugs locally.
Patch 1 —
patch-vertex-node25-fetch.shpatches gaxios to preferglobalThis.fetchovernode-fetch:Patch 2 —
patch-vertex-adc.updated.shpatches:model-auth-env-*.js: returns"<authenticated>"instead of raw marker constantgemini-auth-*.js: guards against placeholder strings inparseGeminiAuthpi-ai/dist/providers/google.js: setsvertexai: true+project/locationwhen provider isgoogle-vertex~/.openclaw/.envand LaunchAgent plist: writesGOOGLE_CLOUD_PROJECT,GOOGLE_CLOUD_LOCATIONLogs, screenshots, and evidence
Bug 1 — node-fetch crash on Node 25:
Bug 2 — ADC marker leak in gateway logs:
Impact and severity
Affected: Users of
google-vertexprovider on Node 25+ (latest macOS default)Severity: High — provider completely unusable on current Node version
Frequency: 100% (always fails on Node 25+)
Consequence:
google-vertexrequests crash; no workaround without patchingAdditional information
Root causes:
gaxiosinside@google/genaiusesimport("node-fetch")fallback unconditionally — Node 18+ has nativeglobalThis.fetchbut gaxios does not check for it.model-auth-envexposes internal credential marker constant to downstream consumers instead of a resolved sentinel value.pi-aigoogle provider does not detectgoogle-vertexprovider mode and fails to setvertexai: trueonGoogleGenAI.EnvironmentVariablesandOPENCLAW_SERVICE_MANAGED_ENV_KEYSdrift apart on restart.Temporary workaround: run the two local patch scripts at
~/gcDora/scripts/patch-vertex-adc.updated.shand~/gcDora/scripts/patch-vertex-node25-fetch.shafter each OpenClaw upgrade.