fix: function invocation 405s on EU/self-hosted (strip /v1/proxy from proxy_conn)#541
Merged
Abhijeet Prasad (AbhiPrasad) merged 1 commit intoJul 6, 2026
Conversation
Function invocation, sandbox listing, and code push all POST through
proxy_conn. For EU/self-hosted orgs the login response sets proxy_url to
`{api_url}/v1/proxy`, but these `function/*` endpoints are served at the API
host root, so requests hit `.../v1/proxy/function/invoke` and return 405
"Method POST not supported". US multi-tenant orgs avoid this only because
their proxy_url falls back to the bare api_url.
Normalize the proxy_conn base URL by stripping a trailing /v1/proxy.
state.proxy_url is left untouched so nothing else that reads it changes.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Member
|
do we have to make the sdk fix here? Can't we just fix this server-side? |
Contributor
Author
|
Abhijeet Prasad (@AbhiPrasad) Given that's the unique report I deferred to limit the fix to a new version of the SDK (same as braintrustdata/braintrust-sdk-javascript#2180) but up to you to decide if this would be better on a server side fix. |
Abhijeet Prasad (AbhiPrasad)
approved these changes
Jul 6, 2026
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.
Issue
Function invocation on EU (and self-hosted) data planes fails with
405 Method POST not supported(Pylon #18531; originally reported on the TypeScript SDK, but the Python SDK has the identical bug).function/invoke,function/sandbox-list, andfunction/codeare all POSTed throughproxy_conn. For EU/self-hosted orgs the login response setsproxy_url = {api_url}/v1/proxy, but thesefunction/*endpoints are served at the API host root, not under/v1/proxy. So the SDK posts to.../v1/proxy/function/invoke→ 405.US multi-tenant orgs avoid this by accident: their stored
proxy_urlis null, so login falls back to the bareapi_url(no/v1/proxy), which routes correctly.Repro on current version
Login on an EU org returns
proxy_url = https://api-eu.braintrust.dev/v1/proxy, andproxy_conn().post("function/invoke", ...)posts under it:api-eu.braintrust.dev/v1/proxy/function/invoke(current SDK)api-eu.braintrust.dev/function/invoke(API host root)Fix
Normalize the
proxy_connbase URL by stripping a trailing/v1/proxy, sofunction/*requests resolve at the API host root on every data plane.state.proxy_urlis left untouched.No endpoint-level regression
Every endpoint that flows through
proxy_connwas probed against both bases — all route at the bare host, all 405 under/v1/proxytoday:/v1/proxyfunction/invokefunction/sandbox-listfunction/codeThe OpenAI-compatible proxy path (chat/completions) does not go through
proxy_conn, so the/v1/proxysuffix it relies on is unaffected.Tests
Added
proxy_connnormalization tests intest_logger.py. Verified end-to-end against a live EU org: login returns.../v1/proxy,proxy_conn().base_urlnow resolves to the bare host.Note
A server-side fix (not stamping
/v1/proxyintoorg.proxy_urlfor EU/self-hosted, matching US) would also fix already-released SDK versions; this SDK change helps users who upgrade.