Skip to content

fix(cli): Make local run and --verify messages say what to do - #2370

Merged
MathurAditya724 merged 1 commit into
mainfrom
fix/local-run-verify-messages
Nov 18, 2026
Merged

MathurAditya724 merged 1 commit into
mainfrom
fix/local-run-verify-messages

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Three small fixes to what sentry local run prints.

Plain local run after a --session run. The Local daemon keeps port 8969 while it holds retained sessions, which can be hours. A plain local run then failed with "A Sentry Local daemon is using this port". The control-plane docs say a plain run can't use the daemon's receiver, since that receiver only takes session traffic, so attaching to it wasn't an option. Turning plain runs into hidden sessions would change what they keep after they exit. So a plain run without --port now captures on a free port and says so, the same way --verify already does. An explicit --port that the daemon holds still fails, because you asked for that port.

--verify printed each failure twice, once as a warning and once as the error. It now prints it once.

--verify with Wrangler. A Worker sends nothing until it gets a request, so a timeout looked the same as broken setup. On a timeout it now says to send the Worker a request, and repeats the tunnel and DSN setup. The local docs also get a short --verify section.

Before:

$ sentry local run --session web -- npm run dev   # exits, the daemon keeps the port
$ sentry local run -- npm run dev
Error: A Sentry Local daemon is using this port. Add --session <name> or choose another --port.

$ sentry local run --verify -- node -e "process.exit(1)"
[warn] Process crashed with code 1
Error: Process crashed with code 1

$ sentry local run --verify --timeout 20 -- wrangler dev
[warn] Verification timed out after 20s — no events received from the SDK
Error: Verification timed out after 20s

After:

$ sentry local run -- npm run dev
[info] The Local daemon is using port 8969, so this run captures on a free port. Add --session <name> to capture into the daemon instead.
[info] Background server listening on http://localhost:40017

$ sentry local run --verify -- node -e "process.exit(1)"
Error: Process crashed with code 1

$ sentry local run --verify --timeout 20 -- wrangler dev
[warn] A Worker sends nothing until it handles a request, so send one to it while --verify waits. @sentry/cloudflare sends here only with `tunnel: env.SENTRY_SPOTLIGHT` and a DSN set (details: sentry help local run)
Error: Verification timed out after 20s — no events received from the SDK

via @MathurAditya724.

--

View Session [Sentry]

A plain `local run` failed while the Local daemon held port 8969, and
it holds that port for as long as it retains sessions. Without --port it
now captures on a free port and says so, the same way --verify already
does. An explicit --port still fails.

--verify printed a crash, an early exit and a timeout twice, once as a
warning and once as the error. It now prints them once. When a Wrangler
Worker times out, it says the Worker needs a request and repeats the
tunnel and DSN setup. The local docs now cover --verify.

Co-Authored-By: Aditya Mathur <[email protected]>
@vercel

vercel Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
sentry-local Ready Ready Preview Nov 18, 2026 4:19pm UTC

Request Review

@MathurAditya724 MathurAditya724 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewed explicit-port precedence, daemon fallback, and verification failures. All 67 Local run/Wrangler tests pass, including real loopback sockets and child processes. No blocking issues found.

@MathurAditya724
MathurAditya724 marked this pull request as ready for review November 18, 2026 18:30
@MathurAditya724
MathurAditya724 merged commit d90c36e into main Nov 18, 2026
28 checks passed
@MathurAditya724
MathurAditya724 deleted the fix/local-run-verify-messages branch November 18, 2026 18:30
MathurAditya724 added a commit that referenced this pull request Nov 19, 2026
Follow-up to #2370. When the Local daemon holds port 8969, a plain
`local run` captures on a free port. The daemon quietly drops anything
that isn't session traffic, so an SDK that hard-codes 8969 (common in
browser setups) lost every event with no hint why.

The notice now gives the port it picked and says to read
`SENTRY_SPOTLIGHT`. `--verify` already had a warning like this, so both
now come from one small helper and can't drift apart.

Before:
```
$ sentry local run -- npm run dev
[info] The Local daemon is using port 8969, so this run captures on a free port. Add --session <name> to capture into the daemon instead.

$ sentry local run --verify -- npm run dev
[info] Port 8969 is in use; verifying on a free port
```

After:
```
$ sentry local run -- npm run dev
[info] Port 8969 is held by the Local daemon, so this run listens on port 40017 instead. SDKs that hard-code 8969 won't reach it; make sure they read SENTRY_SPOTLIGHT. Add --session <name> to capture into the daemon instead.

$ sentry local run --verify -- npm run dev
[info] Port 8969 is in use, so this run listens on port 43321 instead. SDKs that hard-code 8969 won't reach it; make sure they read SENTRY_SPOTLIGHT.
```

<!-- junior-request-attribution:start -->
via @MathurAditya724.
<!-- junior-request-attribution:end -->

<!-- junior-session-footer:start -->
<!-- junior-conversation-id:agent%3Ac09543c99f130ceb0d3f1b55688bbf01 -->

--

[View
Session](https://junior-prod.sentry.dev/conversations/agent%3Ac09543c99f130ceb0d3f1b55688bbf01)
[[Sentry]](https://sentry.sentry.io/explore/conversations/agent%3Ac09543c99f130ceb0d3f1b55688bbf01/?project=4510944073809921)

<!-- junior-session-footer:end -->

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Co-authored-by: Aditya Mathur <[email protected]>

This branch was successfully deployed

1 active deployment
Preview — fa37c54b Deployed Nov 18, 2026 by vercel[bot]
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.

1 participant