Skip to content

Conversation

@yeonjaee
Copy link

Fixes #3651

Problem

When location: 'global' is specified in the Vertex AI plugin, the URL is incorrectly constructed as https://global-aiplatform.googleapis.com, which leads to a 404 error. The correct endpoint for global location should be https://aiplatform.googleapis.com.

Solution

This PR updates the URL construction logic to handle the global location case correctly by removing the location prefix from the domain while keeping it in the path where necessary (e.g. locations/global).

The fix applies to:

  • js/plugins/vertexai/src/list-models.ts
  • js/plugins/vertexai/src/vectorsearch/vector_search/upsert_datapoints.ts
  • js/plugins/vertexai/src/predict.ts
  • js/plugins/vertexai/src/evaluation/evaluator_factory.ts
  • js/plugins/vertexai/src/modelgarden/v2/llama.ts

For llama.ts, the template logic was updated to use a domain without the location prefix when the location is global, while preserving the path structure.

Implementation follows the pattern used in the official Google Gen AI SDK.

Checklist

@google-cla
Copy link

google-cla bot commented Dec 10, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

When location is set to 'global', the plugin was incorrectly constructing
the URL as https://global-aiplatform.googleapis.com, which results in 404.

The correct URL for global endpoint should be https://aiplatform.googleapis.com
without the location prefix.

This fix applies to:
- list-models.ts: Model listing endpoint
- upsert_datapoints.ts: Vector search datapoint upsert endpoint
- predict.ts: Prediction endpoint
- evaluation/evaluator_factory.ts: Evaluation service endpoint
- modelgarden/v2/llama.ts: Llama model garden endpoint

Implementation uses a ternary operator for optimal performance and follows
the same pattern as Google's official Gen AI SDK.

Fixes firebase#3651
@yeonjaee yeonjaee force-pushed the fix/global-location-url branch from cb00fd1 to ad30100 Compare December 10, 2025 02:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

[JS] Vertex AI plugin uses incorrect URL for global location in Genkit

2 participants