Skip to content

feat: support SENTRY_HOST as alias for SENTRY_URL#409

Merged
betegon merged 4 commits intomainfrom
feat/sentry-host-env-var
Mar 12, 2026
Merged

feat: support SENTRY_HOST as alias for SENTRY_URL#409
betegon merged 4 commits intomainfrom
feat/sentry-host-env-var

Conversation

@betegon
Copy link
Member

@betegon betegon commented Mar 12, 2026

Summary

Adds SENTRY_HOST as a supported env var for configuring the Sentry instance URL. It takes precedence over SENTRY_URL so both work, but users who expect SENTRY_HOST (common in other Sentry tooling) get the behavior they want out of the box.

Precedence: SENTRY_HOST > SENTRY_URL > default (https://sentry.io)

Changes

A single getConfiguredSentryUrl() helper in constants.ts replaces all 8 process.env.SENTRY_URL reads across 6 source files. applySentryUrlContext() now sets/deletes both env vars so SENTRY_HOST can't shadow a freshly-set SENTRY_URL.

Test plan

  • New tests for SENTRY_HOST alone and precedence over SENTRY_URL in region, code-scanner, URL parser, and URL builder tests
  • All 146 tests across the 4 modified test files pass
  • bun run typecheck and bun run lint clean

🤖 Generated with Claude Code

betegon and others added 2 commits March 12, 2026 19:01
Add getConfiguredSentryUrl() helper that checks SENTRY_HOST first,
then SENTRY_URL. This gives users the expected env var name while
maintaining backwards compatibility.

Precedence: SENTRY_HOST > SENTRY_URL > default (https://sentry.io)

applySentryUrlContext() now sets/deletes both env vars to prevent
SENTRY_HOST from shadowing a newly-set SENTRY_URL.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Update configuration, self-hosted, and development docs to document
SENTRY_HOST as the primary env var with SENTRY_URL as an alias.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Contributor

github-actions bot commented Mar 12, 2026

Semver Impact of This PR

🟡 Minor (new features)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

Init

  • Add --team flag to relay team selection to project creation by MathurAditya724 in #403
  • Enforce canonical feature display order by betegon in #388
  • Accept multiple delimiter formats for --features flag by betegon in #386
  • Add git safety checks before wizard modifies files by betegon in #379
  • Add experimental warning before wizard runs by betegon in #378
  • Add init command for guided Sentry project setup by betegon in #283

Issue List

  • Auto-compact when table exceeds terminal height by BYK in #395
  • Redesign table to match Sentry web UI by BYK in #372

Other

  • (trial) Auto-prompt for Seer trial + sentry trial list/start commands by BYK in #399
  • Support SENTRY_HOST as alias for SENTRY_URL by betegon in #409
  • Add --dry-run flag to mutating commands by BYK in #387
  • Return-based output with OutputConfig on buildCommand by BYK in #380
  • Add --fields flag for context-window-friendly JSON output by BYK in #373
  • Magic @ selectors (@latest, @most_frequent) for issue commands by BYK in #371
  • Input hardening against agent hallucinations by BYK in #370
  • Add response caching for read-only API calls by BYK in #330

Bug Fixes 🐛

Init

  • Remove implementation detail from help text by betegon in #385
  • Truncate uncommitted file list to first 5 entries by MathurAditya724 in #381

Other

  • (api) Convert --data to query params for GET requests by BYK in #383
  • (docs) Remove double borders and fix column alignment on landing page tables by betegon in #369
  • Add trace ID validation to trace view + UUID dash-stripping by BYK in #375

Internal Changes 🔧

Init

  • Remove --force flag by betegon in #377
  • Remove dead determine-pm step label by betegon in #374

Other

  • Split api-client.ts into focused domain modules by BYK in #405
  • Migrate non-streaming commands to CommandOutput with markdown rendering by BYK in #398
  • Convert Tier 2-3 commands to return-based output and consola by BYK in #394
  • Convert remaining Tier 1 commands to return-based output by BYK in #382
  • Converge Tier 1 commands to writeOutput helper by BYK in #376

Other

  • Minify JSON on read and pretty-print on write in init local ops by MathurAditya724 in #396

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 12, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://cli.sentry.dev/pr-preview/pr-409/

Built to branch gh-pages at 2026-03-12 18:37 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 12, 2026

Codecov Results 📊

104 passed | Total: 104 | Pass Rate: 100% | Execution Time: 0ms

📊 Comparison with Base Branch

Metric Change
Total Tests
Passed Tests
Failed Tests
Skipped Tests

✨ No test changes detected

All tests are passing successfully.

✅ Patch coverage is 100.00%. Project has 698 uncovered lines.
✅ Project coverage is 96.64%. Comparing base (base) to head (head).

Files with missing lines (3)
File Patch % Lines
preload.ts 56.06% ⚠️ 29 Missing
sentry-client.ts 94.55% ⚠️ 12 Missing
code-scanner.ts 97.84% ⚠️ 7 Missing
Coverage diff
@@            Coverage Diff             @@
##          main       #PR       +/-##
==========================================
+ Coverage    96.64%    96.64%        —%
==========================================
  Files          159       159         —
  Lines        20784     20791        +7
  Branches         0         0         —
==========================================
+ Hits         20086     20093        +7
- Misses         698       698         —
- Partials         0         0         —

Generated by Codecov Action

@betegon betegon marked this pull request as ready for review March 12, 2026 18:04
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Copy link
Member

@BYK BYK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks! Just curious why are making the new var tsk precedence?

@betegon
Copy link
Member Author

betegon commented Mar 12, 2026

@BYK as SENTRY_HOST is the same one using for the MCP and it's very unlikely to have a self-hosted user running the MCP and CLI in separate self-hosted instances, i believe we can end up just using SENTRY_HOST at some point and deprecating SENTRY_URL. Whether it's in 1.0.0 or later down the road

@BYK
Copy link
Member

BYK commented Mar 12, 2026

Okay I'm just being pedantic but URL is the more accurate one 🤣

@betegon
Copy link
Member Author

betegon commented Mar 12, 2026

@BYK no lol, i agree with you. but mcp was there first 😆

betegon and others added 2 commits March 12, 2026 19:28
Switch from ?? (nullish coalescing) to || (logical OR) in
getConfiguredSentryUrl() so that empty strings like SENTRY_HOST=""
fall through instead of propagating as valid values. This restores
the pre-refactor behavior where "" was treated as falsy.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@betegon betegon merged commit fe755ee into main Mar 12, 2026
23 checks passed
@betegon betegon deleted the feat/sentry-host-env-var branch March 12, 2026 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants