How we’ve configured error capture in ShipThing.
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.
SENTRY_ORG
, SENTRY_PROJECT
and NEXT_PUBLIC_SENTRY_DSN
.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.