How we’ve configured error capture in zopio
.
zopio
uses Sentry for error tracking and performance monitoring. It helps identify, debug, and resolve issues by providing detailed error reports, stack traces, and performance metrics across both server and client environments. When an error occurs, Sentry captures the full context including the user’s browser information, the sequence of events that led to the error, and relevant application state.
instrumentation.ts
file in your Next.js project initializes Sentry for both Node.js and Edge runtime environments, configuring the DSN (Data Source Name) that routes error data to your Sentry project.
The sentry.client.config.ts
file configures Sentry for the client environment. This includes settings like the sample rate for errors and sessions, and the integrations to use.
The next.config.ts
file imports shared Sentry-specific settings through withSentryConfig
. This enables features like source map uploads for better stack traces and automatic instrumentation of Vercel Cron Monitors. The configuration also optimizes bundle size by tree-shaking logger statements and hiding source maps in production builds.
captureException
function:
sentryConfig.tunnelRoute
option in @repo/next-config
’s Sentry configuration routes browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers. This can increase your server load as well as your hosting bill.