Skip to content

Sentry react-router integration#36

Closed
kentcdodds wants to merge 6 commits into
mainfrom
cursor/sentry-react-router-integration-3ad8
Closed

Sentry react-router integration#36
kentcdodds wants to merge 6 commits into
mainfrom
cursor/sentry-react-router-integration-3ad8

Conversation

@kentcdodds
Copy link
Copy Markdown
Member

@kentcdodds kentcdodds commented Jan 30, 2026

Migrates Sentry integration from @sentry/remix to @sentry/react-router and upgrades @sentry/vite-plugin.

This change updates:

  • Server-side Sentry initialization and error capture to use @sentry/react-router.
  • Client-side Sentry initialization to leverage React Router v6 tracing and capture client error boundary errors with the new SDK.
  • Removes the Remix withSentry wrapper.
  • Updates dependencies to include @sentry/react and @sentry/react-router.
  • Upgrades @sentry/vite-plugin to the latest version.

Test Plan

  • Run npm run dev and manually verify UI functionality (e.g., homepage reload and scroll at http://localhost:3000).
  • Run npm run build to ensure the Vite build pipeline functions correctly with the upgraded plugin.

Checklist

  • Tests updated
  • Docs updated

Screenshots


Homepage reload and scroll after Sentry migration.

homepage-loaded


Open in Cursor Open in Web


Note

Medium Risk
Touches core monitoring/error-capture paths and upgrades Sentry to v10, which could change what gets reported or sampled in production. No business logic changes, but observability regressions are possible if the new integrations are misconfigured.

Overview
Migrates the app’s Sentry integration away from @sentry/remix to the newer SDKs (@sentry/node on the server and @sentry/react on the client), including a major dependency upgrade and associated lockfile churn.

Server-side error reporting is reworked to call Sentry.captureException with explicit request context (url/method/headers) and a react-router mechanism, and server initialization drops Remix auto-instrumentation in favor of explicit http/prisma integrations.

Client-side monitoring switches tracing to reactRouterV7BrowserTracingIntegration, and the UI error boundary now captures unexpected (non-route) errors via Sentry.captureException; the Remix withSentry root wrapper is removed.

Written by Cursor Bugbot for commit 237e5ab. This will update automatically on new commits. Configure here.

cursoragent and others added 2 commits January 30, 2026 15:26
Co-authored-by: me <me@kentcdodds.com>
Co-authored-by: me <me@kentcdodds.com>
@cursor
Copy link
Copy Markdown

cursor Bot commented Jan 30, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@kentcdodds kentcdodds marked this pull request as ready for review January 30, 2026 15:39
Comment thread app/utils/monitoring.client.tsx Outdated
},
integrations: [
browserTracingIntegration({
reactRouterV6BrowserTracingIntegration({
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@cursor, we're running react router v7

Copy link
Copy Markdown

@cursor cursor Bot Jan 30, 2026

Choose a reason for hiding this comment

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

Walkthrough


Homepage reload after v7 tracing switch.

homepage-v7

Summary

  • Switched client tracing to the React Router v7 integration for Sentry browser tracing.【F:app/utils/monitoring.client.tsx†L1-L53】

Testing

  • ✅ Manual reload/scroll at http://localhost:3000 to verify UI renders after the .tsx tracing change (see video).

Open in Cursor Open in Web

Co-authored-by: me <me@kentcdodds.com>
Comment thread app/entry.server.tsx
Comment thread app/utils/monitoring.client.tsx
@cursor
Copy link
Copy Markdown

cursor Bot commented Jan 30, 2026

Bugbot Autofix resolved 2 of the 2 bugs found in the latest run.

  • ✅ Fixed: Server error capture missing request context information
    • Wrapped captureException in a scoped event processor that attaches URL, method, and headers from the request.
  • ✅ Fixed: Client tracing uses React Router v7 integration with v6 hooks
    • Switched to the React Router v6 browser tracing integration to match Remix's routing hooks.

Comment thread package.json Outdated
Comment thread app/components/error-boundary.tsx Outdated
Comment thread app/utils/monitoring.client.tsx Outdated
Comment thread app/components/error-boundary.tsx
@cursor
Copy link
Copy Markdown

cursor Bot commented Jan 30, 2026

Bugbot Autofix resolved 2 of the 2 bugs found in the latest run.

  • ✅ Fixed: Using React Router v6 integration with v7
    • Replaced the v6 tracing integration with the v7 variant to match the app’s React Router version.
  • ✅ Fixed: Non-Error thrown values silently ignored by client error boundary
    • Removed the Error-only guard so client-side error boundaries also capture non-Error thrown values.

Copy link
Copy Markdown

@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 1 potential issue.

},
})
}
}, [error])
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Redundant document check inside useEffect hook

Low Severity

The typeof document !== 'undefined' check inside useEffect is redundant. useEffect only executes on the client side where document is always defined, making this guard condition unnecessary.

Fix in Cursor Fix in Web

@kentcdodds kentcdodds closed this Jan 31, 2026
@kentcdodds kentcdodds deleted the cursor/sentry-react-router-integration-3ad8 branch January 31, 2026 17:01
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