fix: add GOOGLE_VERTEX_LOCATION env var support for Vertex AI#16922
Open
SOUMITRO-SAHA wants to merge 3 commits intoanomalyco:devfrom
Open
fix: add GOOGLE_VERTEX_LOCATION env var support for Vertex AI#16922SOUMITRO-SAHA wants to merge 3 commits intoanomalyco:devfrom
SOUMITRO-SAHA wants to merge 3 commits intoanomalyco:devfrom
Conversation
The @ai-sdk/google-vertex package expects GOOGLE_VERTEX_LOCATION as the standard environment variable for location. Added this env var to the fallback chain in both googleVertexVars() and CUSTOM_LOADERS. Fixes anomalyco#15838
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The @ai-sdk/google-vertex package expects GOOGLE_VERTEX_LOCATION as the standard environment variable for location. Added this env var to the fallback chain in both googleVertexVars() and CUSTOM_LOADERS.
Fixes #15838
Issue for this PR
Closes #15838
Type of change
What does this PR do?
Problem: When using Google Vertex AI models (e.g., gemini-3.1-pro-preview), users get an AI_LoadSettingError even after setting the
GOOGLE_VERTEX_LOCATIONenvironment variable.Root Cause: The code in
packages/opencode/src/provider/provider.tswas only checking GOOGLE_CLOUD_LOCATION and VERTEX_LOCATION environment variables, but the @ai-sdk/google-vertex package expects GOOGLE_VERTEX_LOCATION as the standard environment variable name (confirmed by reading the package's TypeScript definitions and source code innode_modules).Fix: Added GOOGLE_VERTEX_LOCATION to the environment variable fallback chain in two locations:
Why it works: The
@ai-sdk/google-vertexpackage uses loadSetting() with environmentVariableName: "GOOGLE_VERTEX_LOCATION". By checking this environment variable in opencode's provider initialization, the value is now properly passed through to the underlying SDK.How did you verify your code works?
Screenshots / recordings
N/A - backend fix
Checklist