-
Notifications
You must be signed in to change notification settings - Fork 68
Global location generates invalid request endpoint #539
Copy link
Copy link
Open
Labels
api: aiplatformIssues related to the googleapis/nodejs-vertexai API.Issues related to the googleapis/nodejs-vertexai API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Metadata
Metadata
Assignees
Labels
api: aiplatformIssues related to the googleapis/nodejs-vertexai API.Issues related to the googleapis/nodejs-vertexai API.priority: p2Moderately-important priority. Fix may not be included in next release.Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Environment details
Steps to reproduce
Code Example:
Upon making a call to Vertex using
generateContent()for a model only supported inglobal(for example gemini-2.5-flash-lite-preview-06-17), the call will fail due to an invalid base URL resolution.When
apiEndpointis not configured when initializingVertexAI, the following code will prependregionto the base path. This will resolve tohttps://global-aiplatform.googleapis.com/v1/projects...which is not a valid URL and will generate a 404 Not Found upon making the request.Additionally, the library does not fail gracefully when hitting this issue. It throws the following exception back to the client:
instead of an exception describing the problem, thus making debugging significantly more difficult. This is due to the linked code calling
JSON.parse()when the response stream format is an HTML document instead of valid JSON.