Repository navigation
feat(cli): Route org-scoped SDK requests with @sentry/api resolveBaseUrl - #1979
Open
sentry-junior[bot] wants to merge 2 commits into
Open
sentry-junior[bot] wants to merge 2 commits into
sentry-junior[bot] wants to merge 2 commits into
Conversation
getOrgSdkConfig() and sentry api now set @sentry/api's resolveBaseUrl (getsentry/sentry-api-schema#130). Each request whose path names an organization picks its account, server, and region before its URL is built, through resolveOrgRegion. - The 55 getOrgSdkConfig(orgSlug) call sites stop resolving the region up front. getOrgSdkConfig() is now synchronous and takes no org. - sentry api sends org-scoped endpoints to the org's region, as typed commands do, and drops the getDefaultSdkConfig({ path }) workaround from #1978. A full URL is still sent as given. Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
BYK
approved these changes
Nov 5, 2026
BYK
marked this pull request as ready for review
November 5, 2026 12:44
1.29.0 ships Config.resolveBaseUrl (getsentry/sentry-api-schema#130), which getOrgSdkConfig() now passes.
This branch was successfully deployed
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.
Note
Blocked on getsentry/sentry-api-schema#130 and the
@sentry/apirelease that ships it. CI will failtscuntil@sentry/apiis bumped inpnpm-workspace.yaml. I'll bump it here once the release is out.Follow-up to #1978. The routing that #1978 kept in the CLI now uses a per-request hook in
@sentry/api.resolveOrgRegionmoves out of the call sites and into that hook.What changes
resolveOrgBaseUrl(inlib/api/infrastructure.ts) is the CLI'sresolveBaseUrl. When a request's path names an organization, it returnsresolveOrgRegion(org). That call picks the stored account that knows the org (on any server, unless one is set explicitly) and returns the org's region. Unscoped paths keep the base URL. All of this runs before the URL is built.getOrgSdkConfig()is now synchronous and takes no org. It setsresolveBaseUrl, so the 55await getOrgSdkConfig(orgSlug)call sites no longer resolve the region up front. The SDK operation picks the region from its own path. Every one of these call sites uses an org- or project-scoped operation.sentry api(prepareRawApiRequest) uses the same hook. Org-scoped endpoints now go to the org's region (for examplehttps://us.sentry.io), the same way typed commands already do. That replaces thegetDefaultSdkConfig({ path })workaround from fix(cli): Routesentry apiorg requests to accounts on other servers #1978, which is removed. A full URL is still sent as given.apps/cli-docs/src/fragments/commands/api.mdexplains the routing.Behavior notes
sentry api organizations/<org>/...now makes one region lookup first (GET /organizations/<org>/), as typed commands do.--dry-runshows the region URL, so it may make that read-only lookup too.apiRequestToRegion(await resolveOrgRegion(org), path)call sites (about 25) don't go through the SDK client, so they are unchanged. They can move to the same resolver in a follow-up.Tests
account-routing.test.ts:sentry apisends an org-scoped path to the org's cached region (us.sentry.io). This test fails onmain.Checked against a local build of sentry-api-schema#130: CLI
tscand lint pass, and theaccount-routing,commands/api, andlib/apisuites pass (1249 tests). In the full unit suite, the only failures are sandbox-only ones that also fail onmain(completions, upgrade, resilient DB, code-scanner, file-changes, and the auth-message tests in errors, oauth, and auto-login-host-guard).via @BYK.
--
View Session in Sentry