Setting Up Error Monitoring That Actually Helps You Fix Bugs Faster
Your application is throwing errors in production right now. Some of them affect users. Some of them are benign. Some of them indicate a critical problem that will get worse. Without proper error monitoring, you discover issues when a user complains — days or weeks after the error started occurring.
Here is how I set up error monitoring that actually helps me fix bugs faster, not just alerts me that something is wrong.
Why Default Error Handling Is Insufficient
Without explicit monitoring, errors disappear into: server logs that nobody reads, browser consoles that nobody checks, and network requests that fail silently.
Users experience errors as: blank pages, broken features, data that does not save, actions that seem to work but actually fail. They rarely report these issues. They just leave and use a competitor's product.
The gap between "errors occur" and "developers know about errors" should be as close to zero as possible. Error monitoring closes that gap.
Sentry: The Industry Standard
Sentry is what we use at AIDToolStack and what I recommend for most web applications. Here is our actual setup:
Server-side (Next.js API routes and server components): we initialize Sentry in a sentry.server.config file. It captures unhandled exceptions, unhandled rejections, and any errors we manually report. Each error includes: the stack trace, request metadata (URL, method, headers), user context (user ID, subscription tier), and environment (production, staging).
Client-side (React components): we initialize Sentry in a sentry.client.config file. It captures: JavaScript runtime errors, unhandled promise rejections, and React rendering errors (via Error Boundary integration). Each error includes: the stack trace, browser information, user actions leading to the error (breadcrumbs), and performance context.
The key insight: raw error counts are useless. What matters is: how many users are affected, is the error new or recurring, and what is the user impact (does it break a critical flow or a minor feature)?
Configuring Sentry for Signal Over Noise
Default Sentry configuration captures everything, including third-party script errors, browser extension interference, and network errors from flaky mobile connections. This creates noise that buries actual bugs.
Our filtering configuration:
Ignore errors from: browser extensions (errors from chrome-extension:// sources), third-party scripts (advertising, analytics), network errors from poor connections (TimeoutError, NetworkError with no stack trace), and known-benign errors (ResizeObserver loop limit).
Group errors intelligently: Sentry groups errors by stack trace fingerprint. Sometimes different instances of the same bug get different stack traces (especially with source maps). Use custom fingerprinting rules to group related errors.
Set alert thresholds: do not alert on every single error. Alert when: a new error type appears for the first time (likely a new bug), an error rate exceeds a threshold (something broke broadly), or a critical-path error occurs (checkout flow, authentication).
Source Maps: The Critical Piece
Production JavaScript is minified. Without source maps, error stack traces show: "Error at e.js:1:23456" — completely useless for debugging.
Upload source maps to Sentry during your build process. Sentry then translates minified stack traces back to original source code with file names, line numbers, and column positions. This is the difference between a 5-minute fix and a 2-hour investigation.
For Next.js, we use the official Sentry Next.js SDK which handles source map upload automatically during the build. The source maps are uploaded to Sentry and NOT included in the production bundle (users cannot access your original source code).
Breadcrumbs: Understanding How Users Got There
An error in isolation tells you what went wrong. Breadcrumbs tell you what the user did before it went wrong. Sentry automatically records: page navigations, button clicks, network requests, console messages, and state changes.
When investigating an error, I look at breadcrumbs first: "The user navigated to /tools, clicked the filter dropdown, selected 'AI Tools', and then the error occurred." This gives me a reproduction path without asking the user to describe their steps.
Custom breadcrumbs: for important user actions that Sentry does not track automatically, add manual breadcrumbs. We add breadcrumbs for: tool bookmark actions, comparison tool usage, search queries, and authentication state changes. These help us understand context when errors occur in these flows.
Performance Monitoring (Tracing)
Sentry is not just for errors — it traces request performance. We enable transaction tracing for: every API route (how long does the route take end-to-end), database queries (which queries are slow), and external API calls (third-party service latency).
This catches performance regressions before they become user-facing issues. If our tool search endpoint goes from 200ms to 2000ms after a deployment, Sentry alerts us within minutes — before users start complaining about slowness.
Set performance baselines: for each critical endpoint, define an acceptable latency threshold. Alert when the P95 latency exceeds this threshold for more than 5 minutes.
Error Boundaries in React
React Error Boundaries catch rendering errors that would otherwise crash the entire application. Without Error Boundaries, a bug in one component takes down the entire page.
Our pattern: we wrap each major page section in its own Error Boundary. If the sidebar crashes, the main content still renders. If a tool card has a rendering bug, the other cards still display.
Each Error Boundary: renders a fallback UI (not a blank screen), reports the error to Sentry with component context, and provides a recovery action (refresh the section, not the whole page).
Alerts That Lead to Action
A good alert includes: what happened (error type and message), who is affected (user count, affected pages), when it started (is this new or recurring), and a direct link to the error in Sentry with full context.
We route alerts to: Slack for non-critical issues (new error types that affect few users), PagerDuty for critical issues (error rate spikes, authentication failures, payment flow errors), and weekly email digests for trending issues that are not urgent but should be addressed.
The Triage Process
When an error appears, we follow this process:
What Good Error Monitoring Gives You
Peace of mind: you know your application's health at all times. No surprises from user reports.
Faster fixes: errors with full context (stack trace, breadcrumbs, user info) are fixable in minutes, not hours.
Prioritization: you know which errors affect the most users and which critical paths are broken.
Regression detection: new errors after a deployment are immediately visible. You can revert before most users are affected.
Trust: users trust products that work reliably. Error monitoring helps you maintain reliability by catching issues before they compound.
The investment is minimal — a few hours of setup and configuration. The return is enormous: less firefighting, faster debugging, and a more reliable product.
Written by AIDToolStack Editorial
The AIDToolStack editorial team reviews developer tools, AI products, and MCP servers with hands-on testing and honest assessments. We use the tools we review every day in production.
References & Further Reading
Related Posts
Sponsor Our Newsletter
Reach thousands of developers who are actively evaluating AI tools, MCP servers, and dev infrastructure. Our weekly newsletter goes to engaged technical decision-makers.
All sponsored content is clearly labeled per our editorial policy.