React guide

React error tracking

Errilo receives your React errors from the official @sentry/react SDK: rendering errors with their component stack, caught by an error boundary or not. Already on Sentry? Only the DSN changes.

Updated

Errilo is in private beta. This guide describes the setup our compatibility suite tests today.

What gets caught

Our compatibility suite builds a React 19 app with Vite 8 (a production build), serves it, opens it in Chromium and triggers each of these three cases, for every SDK version listed below. Each error reaches Errilo once, with the React component stack.

Not covered by our suite: React 18 and earlier, server rendering, router integrations, and tracing, replay and profiling. Errilo doesn’t store tracing, replay or profiling data: leave them off.

Setup

Install the SDK:

npm install @sentry/react

Then initialize it before rendering, and give createRoot the three React 19 error hooks. This is the file from the React tab of the Errilo app, and the one our suite runs. If you already have a Sentry setup, keep it and change the DSN.

src/main.tsx
import * as Sentry from "@sentry/react";
import { createRoot } from "react-dom/client";
import { App } from "./App";

Sentry.init({
  dsn: "https://<key>@ingest.errilo.com/<project>",
});

// React 19: report rendering errors with their component stack
createRoot(document.getElementById("root")!, {
  onUncaughtError: Sentry.reactErrorHandler(),
  onCaughtError: Sentry.reactErrorHandler(),
  onRecoverableError: Sentry.reactErrorHandler(),
}).render(<App />);

Replace the DSN with the one of your Errilo project. With Vite, the DSN is part of the bundle at build time: rebuild after changing it.

Show a fallback with ErrorBoundary

Sentry.ErrorBoundary shows a fallback instead of an empty page when a component below it throws while rendering:

src/Page.tsx
import * as Sentry from "@sentry/react";

export function Page() {
  return (
    <Sentry.ErrorBoundary fallback={<p>Something went wrong.</p>}>
      <Dashboard />
    </Sentry.ErrorBoundary>
  );
}

With the three hooks above, the error is reported once, by onCaughtError: our suite checks that the boundary doesn’t report it a second time. Without onCaughtError, the boundary reports it itself, also once.

Readable stack traces

In production, a React stack trace points to your minified bundle. The Sentry build plugins upload your source maps at build time, and Errilo implements the same upload API: give it Errilo’s address and an Errilo token in four build variables (SENTRY_URL, SENTRY_ORG, SENTRY_PROJECT, SENTRY_AUTH_TOKEN, see the source maps guide), and frames point to your own files, lines and function names. No organization, project, token or URL goes in the plugin options: the variables are enough.

What our suite checks is the plugin and the symbolication, not a full React app: it builds a small bundle with each plugin version, uploads its source maps and reads the error in Errilo (original file, line, line of code and function name).

Vite (@sentry/vite-plugin). Source maps must be generated, and hidden keeps the sourceMappingURL comment out of your files:

vite.config.ts
import { sentryVitePlugin } from "@sentry/vite-plugin";
import { defineConfig } from "vite";

export default defineConfig({
  build: {
    sourcemap: "hidden", // generate the source maps
  },
  plugins: [sentryVitePlugin()],
});

@sentry/vite-plugin 11.12.0 with Vite 8 has a defect: the plugin uploads a copy of your file with one more line than the file you serve, so the source map is shifted by one line, and the frames of the bundle are reported as @sentry/core instead of your file. The error still arrives and Errilo shows no symbolication error. Until it is fixed, use @sentry/vite-plugin 5.4.1: its upload is symbolicated.

Webpack (@sentry/webpack-plugin). Webpack 5, in production mode, with source maps generated and hidden:

webpack.config.js
const { sentryWebpackPlugin } = require("@sentry/webpack-plugin");

module.exports = {
  mode: "production",
  devtool: "hidden-source-map", // generate the source maps
  plugins: [sentryWebpackPlugin()],
};

Create React App doesn’t let you add a Webpack plugin: you need CRACO, or to eject. Our suite tests the Webpack plugin in a plain Webpack 5 build, not a Create React App or CRACO app.

Source map upload checked by our compatibility suite, by plugin
PluginVersionBundlerBrowser error
@sentry/webpack-plugin4.9.1Webpack 5Symbolicated
@sentry/webpack-plugin5.4.1Webpack 5Symbolicated
@sentry/webpack-plugin11.12.0Webpack 5Symbolicated
@sentry/vite-plugin4.9.1Vite 8Symbolicated
@sentry/vite-plugin5.4.1Vite 8Symbolicated
@sentry/vite-plugin11.12.0Vite 8Not symbolicated: frames reported as @sentry/core

Keep the SDK light

Errilo reads errors and user feedback, and drops traces, profiles, logs and sessions. Don’t set tracesSampleRate or any profiling option, and turn on the build options below: your bundle gets smaller and your users’ browsers send less. Breadcrumbs, release, source maps and user feedback aren’t affected. The same bundleSizeOptimizations option exists in sentryWebpackPlugin(). In a React app, tracing only enters the bundle if you add browserTracingIntegration(): don’t. Details and measured sizes in the migration guide.

vite.config.ts
plugins: [
  sentryVitePlugin({
    // …
    bundleSizeOptimizations: {
      excludeDebugStatements: true,
      excludeTracing: true,
    },
  }),
],

Tested versions

Versions of @sentry/react tested against Errilo
Major versionTested version
v9@sentry/react:9.47.2
v10@sentry/react:10.78.0
v11@sentry/react:11.12.0

With React 19, in a Vite 8 production build opened in Chromium. Tested on SDK 9 to 11, and nothing else: React 18 and earlier, server rendering and router integrations aren’t covered by our suite yet.

Early access

The private beta is open, by invitation, to a handful of teams running a JavaScript, TypeScript, PHP or Python app in production. Join the waitlist and we’ll write to invite you.