JS Vertex AI plugin does not read GOOGLE_CLOUD_LOCATION, unlike Go and Python
js/plugins/google-genai/src/vertexai/utils.ts has no occurrence of GOOGLE_CLOUD_LOCATION. Location comes from GCLOUD_LOCATION only:
- multi-regional:
options?.location || process.env.GCLOUD_LOCATION, throws when unset (utils.ts:255-259) - regional: same, defaulting to
us-central1(utils.ts:289-290)
Go uses firstEnv("GOOGLE_CLOUD_LOCATION", "GOOGLE_CLOUD_REGION") (go/plugins/googlegenai/googlegenai.go). Python falls back to GOOGLE_CLOUD_LOCATION or GCLOUD_LOCATION (py/packages/genkit-google-genai/src/genkit_google_genai/google.py).
Vertex AI Agent Engine injects GOOGLE_CLOUD_LOCATION, not GCLOUD_LOCATION. Project resolution survives on other fallbacks; location does not.
Unreconciled: the multi-regional throw looks swallowed (utils.ts:126-128) before regional is tried, which defaults, so I would expect a silent wrong region. We saw a throw on first request. No minimal repro yet, so trust the env var gap over my account of the failure mode.
Fix: add GOOGLE_CLOUD_LOCATION to the fallback chain in both functions.
Hi! I would like to work on this issue. My plan: add GOOGLE_CLOUD_LOCATION to the fallback chain in both functions in js/plugins/google-genai/src/vertexai/utils.ts (multi-regional and regional), mirroring the Go/Python behavior, plus a unit test. One question before I start: should the chain also include GOOGLE_CLOUD_REGION like the Go plugin (firstEnv GOOGLE_CLOUD_LOCATION, GOOGLE_CLOUD_REGION), or keep it to GOOGLE_CLOUD_LOCATION + GCLOUD_LOCATION? Thanks!
Opened PR #6386 with the fix (fallback chain + updated error messages + 3 unit tests). Still happy to add GOOGLE_CLOUD_REGION too if you prefer Go parity. Google CLA is already signed on my account.
Hi! It looks like the earlier attempt (#6386) was closed without merging. If nobody is working on this anymore, I'd be happy to pick it up and send a fix with tests.