Skip to content
This repository was archived by the owner on Oct 23, 2026. It is now read-only.

fix(cli): Handle empty regionUrl from self-hosted Sentry - #1522

Merged
BYK merged 2 commits into
mainfrom
seer/fix/cli-empty-region-url
Sep 2, 2026
Merged

BYK merged 2 commits into
mainfrom
seer/fix/cli-empty-region-url

Conversation

@sentry

@sentry sentry Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Self-hosted Sentry instances can return an empty string ("") for links.regionUrl when fetching organization details. The CLI's region resolution logic in packages/cli/src/lib/region.ts used the nullish coalescing operator (??), which only guards against null or undefined. This allowed the empty string to be used as the regionUrl.

Consequently, when getSdkConfig("") was called, it led to the construction of a relative API URL (e.g., /api/0/projects/...) without a base host. This relative URL then caused new Request() (from undici) to throw a TypeError: Failed to parse URL.

This fix changes the region resolution from response.data?.links?.regionUrl ?? baseUrl to response.data?.links?.regionUrl || baseUrl. The logical OR operator (||) correctly treats an empty string as a falsy value, ensuring that baseUrl is used as a fallback when regionUrl is an empty string. This prevents the invalid URL construction and the subsequent TypeError.

Fixes CLI-2E1

@sentry <feedback>: Autofix iterates on these changes
@sentry stop iterating: Autofix stops iterating on this run

This PR was automatically generated by Sentry. You can adjust this setting at any time.

@vercel

vercel Bot commented Sep 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cli Ready Ready Preview Sep 2, 2026 10:47am UTC

Request Review

@sentry
sentry Bot marked this pull request as ready for review September 2, 2026 10:54
@BYK
BYK merged commit cf21077 into main Sep 2, 2026
34 checks passed
@BYK
BYK deleted the seer/fix/cli-empty-region-url branch September 2, 2026 13:56

This branch was successfully deployed

1 active deployment
Preview — aabc16c2 Deployed Sep 2, 2026 by vercel[bot]
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant