Repository navigation
fix(cli): harden ported wizard codemods against real-world project shapes - #2565
Open
sentry-junior[bot] wants to merge 11 commits into
Open
sentry-junior[bot] wants to merge 11 commits into
sentry-junior[bot] wants to merge 11 commits into
Conversation
…apes
React Router:
- handleError: report before the handler's own code runs, for both function
and const exports, and bind `request` from the handler's own parameters.
- vite: pass the defineConfig callback's own config env to sentryReactRouter.
- package.json: keep the project's start command and merge NODE_OPTIONS with
shell semantics instead of replacing the command.
Remix:
- root: find `export { ErrorBoundary }` and `export const ErrorBoundary`
boundaries, and capture under the name useRouteError is bound to.
- handleError: wrap the whole existing handler so async and params survive.
- example page: create the /api/sentry-example-api route it fetches.
- custom Express servers: import the instrumentation file relative to the
server file.
SvelteKit:
- Svelte 5 example page: make isConnected reactive with $state.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
…react-router' into feat/cli-wizard-port-review-fixes Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
- vite: the added config env parameter uses a name nothing in the file uses
yet (config, then configEnv, ...), and defaulted parameters such as
`({ mode } = {})` or `(env = {})` are handled.
- Remix root: `useRouteError() as Error` and `useRouteError()!` count as the
boundary's existing error read.
Co-Authored-By: BYK <126780+BYK@users.noreply.github.com>
…/cli-wizard-port-review-fixes
…/cli-wizard-port-review-fixes
…/cli-wizard-port-review-fixes
BYK
approved these changes
Nov 27, 2026
BYK
enabled stacked auto-merge
November 27, 2026 22:59
…/cli-wizard-port-review-fixes # Conflicts: # packages/cli/test/lib/wizard/react-router/sdk-setup.test.ts
…/cli-wizard-port-review-fixes
…/cli-wizard-port-review-fixes
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e957aca. Configure here.
| /NODE_OPTIONS=([^\s]+(?:\s+[^\s]+)*?)(\s+(?:react-router-serve|react-router|node|npx|tsx))/, | ||
| `NODE_OPTIONS='${mergedOptions}'${commandPart}`, | ||
| nodeOptions[0], | ||
| () => `${nodeOptions[1] ?? ""}NODE_OPTIONS='${mergedOptions}'`, |
Contributor
There was a problem hiding this comment.
Quoted NODE_OPTIONS can break scripts
Low Severity
The new NODE_OPTIONS matcher accepts a double-quoted value that contains single quotes, then always rewrites it as a single-quoted string. That closes the quote early and can split or drop the original options, so the merged --import never reaches Node.
Reviewed by Cursor Bugbot for commit e957aca. Configure here.
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.


Stacked on #2526. It fixes the Warden and Bugbot findings on that PR where the fix changes the wizard's behaviour relative to upstream
getsentry/sentry-wizard(v9.1.0).Behaviour changes vs upstream sentry-wizard
handleError(function export, error-only params): bindsrequestfrom the handler's parameters, adding{ request }when needed. Upstream usedrequestunbound, so the handler threw. (CC6-JTR)handleError(const or arrow export):Sentry.captureExceptionnow goes first in the body, as it already did for function exports, so an earlyreturnno longer skips it. (6BK-CX9)handleError(named second parameter): the guard readsargs.request/context.requestfrom the existing parameter instead of assuming a destructuredrequest.vite.config:sentryReactRouter(…, <env>)gets thedefineConfigcallback's own parameter, with or without a default. If there is none, or it is destructured (({ mode })), the wizard picks a name nothing in the file uses yet (config, thenconfigEnv). A destructured parameter is destructured again in the body and keeps its default. Upstream always passedconfig. (NTK-WRA)startscript: keeps the project's own command and addsNODE_ENV=production NODE_OPTIONS='--import ./instrument.server.mjs'in front of it. Upstream replaced any start script withoutNODE_OPTIONSwithreact-router-serve ./build/server/index.js. A default project gets the same command as before. (55R-DRR)NODE_OPTIONSmerge: an unquoted value ends at the first whitespace, as in a shell. The import is merged in before any command (e.g.pm2), and sibling variables likePORT=3000stay separate. Upstream allowlisted commands and absorbed the following tokens. (QRC-596)export { ErrorBoundary }: the existing boundary is found and instrumented. Upstream added a duplicateErrorBoundary. (X9W-F69)export const ErrorBoundary: arrow and function-expression boundaries are instrumented, and an expression body becomes a block body. Upstream left them unchanged. (SFV-22K)captureRemixErrorBoundaryError(<name>)goes right after theuseRouteError()read (alsouseRouteError() as ErrororuseRouteError()!) and uses the boundary's own binding (e.g.routeError). Upstream usederrorbefore the last statement. (UWP-WMX)export const ErrorBoundary = withX(…)): the wizard warns with the line to add. Upstream skipped it silently.handleError: wraps the existing handler as a whole (Sentry.wrapHandleErrorWithSentry(<original>)), which keepsasync, parameters, expression bodies and handlers built elsewhere. Upstream copied the body into a fixed non-async arrow, or threw on expression bodies. (7JW-LJX, 484-EKL)app/routes/api.sentry-example-api.(ts|js), the route the page's button fetches. Upstream never created it, so the button got a 404. (HTF-GHR)../instrumentation.server.mjsfromserver/index.ts). Upstream always used./. (QPF-CJ8)isConnecteduses$state(true), so the connectivity warning and the disabled button update. (XYK-TL6)Product calls
startscript keeps the user's command. For a defaultreact-router-serve ./build/server/index.jsproject, the result matches the React Router manual setup docs.handleErroroutput is theSentry.wrapHandleErrorWithSentry(...)form from the Remix manual setup docs, wrapped around the user's own handler.via @BYK.
--
View Session [Sentry]