Overview
src/lib/errors/index.ts contains a TODO comment to replace console.error with a Sentry integration. In production, unhandled errors are only visible in server logs — there is no alerting, grouping, user-impact counting, or stack-trace deduplication. This makes incident response entirely reactive and manual.
Specifications
Features:
- Unhandled errors are reported to Sentry with full context (user ID, request path, environment)
- Repeated errors are deduplicated and grouped
- Critical errors trigger alerts
Tasks:
- Install
@sentry/nextjs and run the Sentry wizard
- Configure Sentry DSN via
SENTRY_DSN environment variable
- Replace
console.error calls in src/lib/errors/index.ts with Sentry.captureException()
- Add user context:
Sentry.setUser({ id: userId })
- Add
sentry.server.config.ts and sentry.client.config.ts
Impacted Files:
src/lib/errors/index.ts
src/app/error.tsx
src/app/global-error.tsx
.env.example
Acceptance Criteria
- Errors captured by
error.tsx appear in the Sentry dashboard
SENTRY_DSN is documented in .env.example
- No
console.error calls remain for exception tracking in production paths
Overview
src/lib/errors/index.tscontains a TODO comment to replaceconsole.errorwith a Sentry integration. In production, unhandled errors are only visible in server logs — there is no alerting, grouping, user-impact counting, or stack-trace deduplication. This makes incident response entirely reactive and manual.Specifications
Features:
Tasks:
@sentry/nextjsand run the Sentry wizardSENTRY_DSNenvironment variableconsole.errorcalls insrc/lib/errors/index.tswithSentry.captureException()Sentry.setUser({ id: userId })sentry.server.config.tsandsentry.client.config.tsImpacted Files:
src/lib/errors/index.tssrc/app/error.tsxsrc/app/global-error.tsx.env.exampleAcceptance Criteria
error.tsxappear in the Sentry dashboardSENTRY_DSNis documented in.env.exampleconsole.errorcalls remain for exception tracking in production paths