Skip to content

[VertexAI] Incorrect API endpoint generated when location is "global" #11845

@minkichoe-lbox

Description

@minkichoe-lbox

Environment details

  1. API: vertexai
  2. OS type and version: N/A (code-level issue)
  3. Java version: N/A
  4. Version(s): Affects current main branch (commit c70c873)

Description

When location is set to "global", the VertexAI class generates an incorrect API endpoint.

Current behavior:
The endpoint is constructed as global-aiplatform.googleapis.com

Expected behavior:
The endpoint should be aiplatform.googleapis.com (without the global- prefix)

Steps to reproduce

  1. Create a VertexAI instance with location set to "global"
  2. Observe the generated apiEndpoint

Code example

// Current implementation in VertexAI.java
this.apiEndpoint =
    apiEndpoint.orElse(String.format("%s-aiplatform.googleapis.com", this.location));

// When location = "global", this produces:
// "global-aiplatform.googleapis.com" (incorrect)

// Expected:
// "aiplatform.googleapis.com"

Suggested fix

this.apiEndpoint = apiEndpoint.orElse(
    "global".equals(this.location)
        ? "aiplatform.googleapis.com"
        : String.format("%s-aiplatform.googleapis.com", this.location)
);

External references

Additional information

The global endpoint aiplatform.googleapis.com is used for accessing Vertex AI resources that are available globally, and it does not follow the regional endpoint pattern of {location}-aiplatform.googleapis.com.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions