Skip to content

fix: use appropriate domain for vertex global #6810

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 15, 2025

Conversation

zabealbe
Copy link
Contributor

@zabealbe zabealbe commented Jun 20, 2025

Background

Global region for google vertex does not work, this is especially necessary as some models in their first release are exclusively available on global region. As of today this is the case for gemini-2.5-flash-lite.

To test this just set the following env flag
GOOGLE_VERTEX_LOCATION="global"

The pattern used in @ai-sdk/google-vertex is
https://${region}-aiplatform.googleapis.com/v1/projects/${project}/locations/${region}/publishers/google

However for global endpoints the domain is different (see docs)
https://aiplatform.googleapis.com/v1/...

Resulting in the following error

error: APICallError [AI_APICallError]: Publisher Model `projects/[PROJECT_ID]/locations/us-central1/publishers/google/models/gemini-2.5-flash-lite-preview-06-17` was not found or your project does not have access to it. Please ensure you are using a valid model version. For more information, see: https://cloud.google.com/vertex-ai/generative-ai/docs/learn/model-versions
      at <anonymous> ([LOCAL_PATH]/node_modules/@ai-sdk/provider-utils/src/response-handler.ts:59:16)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async postToApi ([LOCAL_PATH]/node_modules/@ai-sdk/provider-utils/src/post-to-api.ts:111:28)
      at async GoogleGenerativeAILanguageModel.doStream ([LOCAL_PATH]/node_modules/@ai-sdk/google/src/google-generative-ai-language-model.ts:311:50)
      at async fn ([LOCAL_PATH]/node_modules/ai/core/generate-text/stream-text.ts:1032:25)
      at async <anonymous> ([LOCAL_PATH]/node_modules/ai/core/telemetry/record-span.ts:18:22)
      at async _retryWithExponentialBackoff ([LOCAL_PATH]/node_modules/ai/util/retry-with-exponential-backoff.ts:36:12)
      at async streamStep ([LOCAL_PATH]/node_modules/ai/core/generate-text/stream-text.ts:987:15)
      at async fn ([LOCAL_PATH]/node_modules/ai/core/generate-text/stream-text.ts:1466:9)
      at async <anonymous> ([LOCAL_PATH]/node_modules/ai/core/telemetry/record-span.ts:18:22) {
    cause: undefined,
    url: 'https://global-aiplatform.googleapis.com/v1/projects/[PROJECT_ID]/locations/us-central1/publishers/google/models/gemini-2.5-flash-lite-preview-06-17:streamGenerateContent?alt=sse',

Summary

Toggle to use a different pattern in case region === 'global'

Verification

Tasks

  • Tests have been added / updated (for bug fixes / features)
  • Documentation has been added / updated (for bug fixes / features)
  • A patch changeset for relevant packages has been added (for bug fixes / features - run pnpm changeset in the project root)
  • Formatting issues have been fixed (run pnpm prettier-fix in the project root)

Future Work

Related Issues

@zabealbe zabealbe changed the title fix: use appropriate base domain for vertex global fix: use appropriate domain for vertex global Jun 20, 2025
@matthew-magical
Copy link

See the existing PR at #6646

@lgrammel
Copy link
Collaborator

hi can you rebase against latest main?

@zabealbe zabealbe changed the base branch from main to add-claude-4-guide-v5 July 11, 2025 00:36
@zabealbe zabealbe changed the base branch from add-claude-4-guide-v5 to main July 11, 2025 00:37
@zabealbe zabealbe force-pushed the fix/google-vertex-global branch from e2d3db7 to 9ff4b3a Compare July 11, 2025 00:38
@lgrammel
Copy link
Collaborator

please run prettier-fix

@zabealbe zabealbe force-pushed the fix/google-vertex-global branch from 9ec16ce to 56336f1 Compare July 14, 2025 16:03
@lgrammel
Copy link
Collaborator

tests are failing

@zabealbe zabealbe force-pushed the fix/google-vertex-global branch from 56336f1 to 1e97f0a Compare July 15, 2025 12:19
@lgrammel lgrammel merged commit 6ca44f2 into vercel:main Jul 15, 2025
7 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy