Skip to content

[Enhancement] Error monitoring uses console.error only — no Sentry or structured error tracking #763

Description

@RUKAYAT-CODER

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions