Sentry
@spree/dashboard-sentry reports errors from the admin dashboard and the seller panel. Install it in each app you deploy:
src/main.tsx, before the app renders:
initDashboardSentry takes any Sentry browser option, plus:
VITE_ values are compiled into the browser bundle, so set them when you build, not only when you run the server. Call it the same way in the seller panel’s src/main.tsx.
What gets reported:
- Uncaught errors and unhandled promise rejections.
- Errors a page throws while rendering or loading data, including the ones the panel’s error screen catches and shows.
- The signed-in user’s ID and email, cleared on sign-out.
- A
paneltag,adminorseller, so both apps can share one Sentry project. Events raised while the app starts are tagged too.
redacted in error events and breadcrumbs before they leave the browser, after your own beforeSend and beforeBreadcrumb run.
The plugin turns on error reporting only. Tracing, Session Replay and other Sentry features stay off unless you pass their options. Token redaction does not cover them: replays and trace spans can record the page URL, including a reset or invitation token.
Readable stack traces
A production build is minified, so its stack traces are unreadable until Sentry has the build’s source maps. Upload them at build time with Sentry’s Vite plugin:SENTRY_AUTH_TOKENis read only while building, in Node, so it never reaches the browser bundle. Keep it out ofVITE_variables, which are.sourcemap: 'hidden'writes the maps without linking them from the bundle, andfilesToDeleteAfterUploadremoves them once uploaded, so they are not deployed with the app.- The plugin also sets the release on each event, so
initDashboardSentryneeds noreleaseoption. - Without
SENTRY_AUTH_TOKENthe plugin skips the upload, so local builds work without it.
spreeSellerDashboardPlugin() in its own vite.config.ts the same way.
Another service
An error-tracking plugin needs two things from the dashboard:errorReportersindefineDashboardPlugin, keyed by a unique id. Each one is called with every error the panel’s error screens catch. These errors never reachwindow.onerror, where most error trackers listen.- The
app.rootslot, rendered once inside the signed-in session, to attach the user to reports.
reportCaughtError from @spree/dashboard-core as the onCatch of RouteErrorBoundary or TanStack Router’s CatchBoundary.
Call defineDashboardPlugin from a function the host calls in its entry module, as initDashboardSentry does, or mark the package as a dashboard plugin so both panels load it on install — see Distributing plugins.
