React errors with the component stack, on your machine
Install @sentry/react, set the DSN to http://sentry@127.0.0.1:8000/1, and wrap your app in Sentry.ErrorBoundary. A React error then shows up in Buggregator on your machine, with its stack trace and, linked to it, the component stack. The browser sends it straight to Buggregator: no CORS setup, no Sentry account.
Steps
1. Start Buggregator
Your React code runs in the browser, so the browser must reach port 8000.
docker run --pull always \
-p 127.0.0.1:8000:8000 \
ghcr.io/buggregator/server:latest2. Install the SDK
npm install @sentry/react --save3. Init Sentry before the app
Put this in instrument.js. Use 127.0.0.1, not a Docker Compose service name: the browser cannot resolve service names.
import * as Sentry from "@sentry/react";
Sentry.init({
dsn: "http://sentry@127.0.0.1:8000/1",
integrations: [Sentry.browserTracingIntegration()],
tracesSampleRate: 1.0,
enableLogs: true,
});Import it first in main.jsx.
import "./instrument";
import { createRoot } from "react-dom/client";
import App from "./App";
createRoot(document.getElementById("root")).render(<App />);4. Catch render errors with the component stack
Wrap the part of the tree you care about. With React 17 or newer, the SDK attaches the component stack to the error it reports.
import * as Sentry from "@sentry/react";
function App() {
return (
<Sentry.ErrorBoundary fallback={<p>Something went wrong</p>}>
<Dashboard />
</Sentry.ErrorBoundary>
);
}On React 19, also report errors outside boundaries from createRoot:
createRoot(document.getElementById("root"), {
onUncaughtError: Sentry.reactErrorHandler(),
onCaughtError: Sentry.reactErrorHandler(),
onRecoverableError: Sentry.reactErrorHandler(),
}).render(<App />);5. Throw and look
Make a component throw while rendering, then open http://127.0.0.1:8000. The error's Exceptions tab shows the error with its stack trace and, as a second linked entry, the component stack. Breadcrumbs show the clicks and requests before it. The page load shows up on the Sentry page, Traces tab.
Why it works
Buggregator accepts the Sentry protocol, and by default it accepts requests from any origin, so the browser SDK can post to it directly. The SDK sends the component stack as a linked error, and Buggregator shows every error in the chain.
Docs: docs.buggregator.dev/guides/frontend.html#_3-set-up-the-sdk
Requires Buggregator v2.9.0+
Related tips
- Sentry
Next.js errors and traces on your machine, Sentry SDK as is
Keep @sentry/nextjs and point its DSN at Buggregator. Client and server errors and traces of your Next.js app show up locally, no Sentry account.
- Sentry
Express errors and traces locally with @sentry/node
Point @sentry/node at Buggregator and load it before Express. Route errors, request traces and logs of your Express app show up on your machine.
- Sentry
See what happened right before the exception
Point your Laravel Sentry DSN at Buggregator. Each error shows its breadcrumbs, request, tags and stack trace on your laptop.
- Sentry
See a Laravel request's Sentry trace as a waterfall
Turn on Sentry tracing in Laravel and send it to Buggregator. Every span of a request shows on a timeline, and errors link to their trace.
Checked on with Buggregator v2.13.0