Repository navigation
fix(client): skip mTLS URL rewriting for multi-regional .rep.googleapis.com endpoints and honor GOOGLE_API_USE_MTLS_ENDPOINT in Google Auth sessions - #3135
Merged
Conversation
copybara-service
Bot
force-pushed
the
copybara/998988334
branch
from
October 14, 2026 00:29
14341ec to
fd5bf1e
Compare
copybara-service
Bot
force-pushed
the
copybara/998988334
branch
from
October 21, 2026 20:42
fd5bf1e to
2e09657
Compare
…is.com endpoints and honor GOOGLE_API_USE_MTLS_ENDPOINT in Google Auth sessions Multi-regional Vertex AI endpoints (`aiplatform.us.rep.googleapis.com` and `aiplatform.eu.rep.googleapis.com`) do not publish `.rep.mtls.googleapis.com` DNS records. When `GOOGLE_API_USE_CLIENT_CERTIFICATE=true` is set (such as on Vertex AI Agent Engine with `AGENT_IDENTITY=true`), rewriting these URLs in `to_mtls_url()` causes requests to fail with `NXDOMAIN` (`Name or service not known`). Additionally, `_request_once`, `_async_request_once`, `download_file`, and `async_download_file` previously checked `session._is_mtls` directly when using `AuthorizedSession` / `AsyncAuthorizedSession`, bypassing `_use_mtls_endpoint()` and ignoring `GOOGLE_API_USE_MTLS_ENDPOINT=never`. - Update `to_mtls_url()` to leave multi-regional `.us.rep.` and `.eu.rep.` endpoints unchanged while continuing to rewrite single-region `.rep.` endpoints. - Gate `to_mtls_url()` in the synchronous and asynchronous Google Auth session paths via `self._use_mtls_endpoint(client_cert_loaded=...)`. PiperOrigin-RevId: 1004213757
copybara-service
Bot
force-pushed
the
copybara/998988334
branch
from
October 21, 2026 21:03
2e09657 to
4e44c84
Compare
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.
fix(client): skip mTLS URL rewriting for multi-regional .rep.googleapis.com endpoints and honor GOOGLE_API_USE_MTLS_ENDPOINT in Google Auth sessions
Multi-regional Vertex AI endpoints (
aiplatform.us.rep.googleapis.comandaiplatform.eu.rep.googleapis.com) do not publish.rep.mtls.googleapis.comDNS records. WhenGOOGLE_API_USE_CLIENT_CERTIFICATE=trueis set (such as on Vertex AI Agent Engine withAGENT_IDENTITY=true), rewriting these URLs into_mtls_url()causes requests to fail withNXDOMAIN(Name or service not known).Additionally,
_request_once,_async_request_once,download_file, andasync_download_filepreviously checkedsession._is_mtlsdirectly when usingAuthorizedSession/AsyncAuthorizedSession, bypassing_use_mtls_endpoint()and ignoringGOOGLE_API_USE_MTLS_ENDPOINT=never.to_mtls_url()to leave multi-regional.us.rep.and.eu.rep.endpoints unchanged while continuing to rewrite single-region.rep.endpoints.to_mtls_url()in the synchronous and asynchronous Google Auth session paths viaself._use_mtls_endpoint(client_cert_loaded=...).