Catch errors in production before users have to tell you. Sign up, install the SDK, paste a DSN, ship. Five minutes for a usable setup; another fifteen for source maps and releases.
In sentry.io β, click Projects β Create Project. Pick your platform (e.g., "Node.js", "Next.js"). Name it. Click Create Project.
Sentry shows you the DSN β a URL that looks like:
https://[email protected]/678901
Copy it. Store in your backend env:
SENTRY_DSN=https://[email protected]/678901
The DSN is not secret in the way an API key is β it's safe in client-side bundles β but treat it as configuration.
npm install --save @sentry/node
Other runtimes: npm install @sentry/react, pip install --upgrade sentry-sdk, etc. Check the platform-specific page from Step 0.
Initialize Sentry before your app does anything else. In Node, that's the very first line of your entrypoint:
// Must be the FIRST import in your app's entry file
const Sentry = require("@sentry/node");
Sentry.init({
dsn: process.env.SENTRY_DSN,
tracesSampleRate: 1.0, // 100% perf monitoring while you're learning; lower later
environment: process.env.NODE_ENV || "development",
});
// ... rest of your app
For browser JS / Next.js / Python, the shape is the same: Sentry.init({ dsn: ..., ... }), called once at startup. Each platform's docs (Step 0) shows where exactly.
Throw something on purpose to confirm Sentry is wired up:
Sentry.captureException(new Error("Sentry test from my app"));
Or trigger an actual uncaught error β Sentry installs global handlers automatically, so any uncaught exception or unhandled promise rejection is reported without you doing anything.
Go to sentry.io β Issues β. Your test error should appear within a few seconds. Click it to see the stack trace, request context, breadcrumbs.
Pass your app's version to Sentry. Now every error is tagged with which release it came from β you can see "this bug appeared in 1.4.2."
Sentry.init({
dsn: process.env.SENTRY_DSN,
release: "myapp@" + process.env.APP_VERSION, // e.g. [email protected]
environment: process.env.NODE_ENV,
});
Combine with the Sentry CLI β in your deploy pipeline to create release records:
sentry-cli releases new "myapp@$APP_VERSION"
sentry-cli releases finalize "myapp@$APP_VERSION"
Production JS is minified. Without source maps, your Sentry stack traces look like a.b.c at e.min.js:1:1234 β useless.
The official wizards do this for you:
# Next.js
npx @sentry/wizard@latest -i nextjs
# React (Vite)
npx @sentry/wizard@latest -i sourcemaps
Or manually with sentry-cli sourcemaps β. Native iOS/Android: the SDKs handle dSYMs / mapping files automatically via Gradle/CocoaPods plugins.
Once errors start flowing, you'll see noise (Chrome extension errors, expected validation errors, dev-mode bugs). Filter:
Sentry.init({
dsn: process.env.SENTRY_DSN,
beforeSend(event, hint) {
// Skip dev errors
if (process.env.NODE_ENV === "development") return null;
// Skip known noise
const err = hint.originalException;
if (err && err.message && err.message.includes("ResizeObserver loop")) {
return null;
}
return event;
},
ignoreErrors: [
"ResizeObserver loop limit exceeded",
/^Network request failed$/,
],
});
Each ignored pattern saves event quota and reduces alert noise. Tune over time.
Default project settings already email you on new issues. To configure:
Sentry β your project β Alerts β Create Alert. Common rules:
Route to Slack / PagerDuty / email via the alert integrations. Alerts docs β.
Click any issue in the dashboard:
beforeSend to scrub, or set sendDefaultPii: false (the default). Sensitive data docs β.
Free tier: 5,000 errors + 10,000 performance events + 50 replays per month. Real production apps hit this fast if you have any uncaught error in a hot loop.
Paid tiers start around $26/mo for Team. Worth it once your app has real users. Sentry pricing β.
Self-hosted alternative: Sentry's source is open. You can self-host β, but the operational burden is real (Docker Compose, ClickHouse, Postgres, Redis). Most people don't.