Skip to content

Implement Sentry error monitoring with PII protection#117

Merged
mostafazh merged 3 commits into
TechForPalestine:mainfrom
mostafazh:sentry-dsn-setup
Jun 22, 2026
Merged

Implement Sentry error monitoring with PII protection#117
mostafazh merged 3 commits into
TechForPalestine:mainfrom
mostafazh:sentry-dsn-setup

Conversation

@mostafazh

Copy link
Copy Markdown
Collaborator

This pull request introduces Sentry error monitoring to the project, with careful configuration to protect user privacy and to avoid collecting data in non-production environments. Sentry is set up for the client, server, and edge runtimes, and a global error handler is added to capture and report exceptions. The integration is designed to avoid collecting user information and to limit data collection to production only.

Sentry Integration and Configuration:

  • Added @sentry/nextjs as a dependency in package.json to enable Sentry error tracking.
  • Introduced Sentry initialization files for the client (sentry.client.config.ts), server (sentry.server.config.ts), and edge (sentry.edge.config.ts) environments, each configured to:
    • Use a shared DSN and environment variable.
    • Disable user info and HTTP body data collection for privacy.
    • Sample 100% of traces in development and 10% in production.
    • Drop errors from non-production environments before sending. [1] [2] [3]

Error Handling:

  • Added a global error boundary in src/app/global-error.tsx that captures exceptions with Sentry and renders a generic error page using Next.js's default error component.
  • Updated src/instrumentation.ts to dynamically import the appropriate Sentry config based on runtime and export Sentry's request error capture function.

Mostafa Zaher added 2 commits June 23, 2026 02:22
… filtering

- Set up @sentry/nextjs for client, server, and edge runtimes.
- Disable user info and request/response body collection via dataCollection.
- Tag events with NODE_ENV and drop non-production errors before they
  reach the production Sentry project.
- Remove Vercel-specific assumptions (no VERCEL_ENV, no Vercel Cron
  Monitors instrumentation).
Move plugin:@typescript-eslint/recommended into an override for *.ts
and *.tsx so that JavaScript config files like next.config.js are not
checked by TypeScript-specific rules such as no-var-requires.
- Add .git-hooks/pre-push that runs npm run lint before each push.
- Add prepare script to package.json so npm install sets
  core.hooksPath to .git-hooks for every clone.
- Bypass with git push --no-verify when needed.
@mostafazh mostafazh merged commit bfbd757 into TechForPalestine:main Jun 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant