Skip to content

feat: integrate Sentry error monitoring for client and backend#239

Open
Vivian-04 wants to merge 1 commit intoCalebux:mainfrom
Vivian-04:feat/sentry-integration
Open

feat: integrate Sentry error monitoring for client and backend#239
Vivian-04 wants to merge 1 commit intoCalebux:mainfrom
Vivian-04:feat/sentry-integration

Conversation

@Vivian-04
Copy link
Copy Markdown

PR #168 Add Sentry error monitoring for both client and backend

Description

This PR implements comprehensive error tracking and monitoring across the entire SYNCRO stack by integrating Sentry.

Key Changes

Backend (/backend)

  • Sentry SDK Integration: Installed @sentry/node and @sentry/profiling-node.
  • Initialization: Configured Sentry at the top of src/index.ts with profiling and tracing enabled.
  • Middleware: Integrated Sentry.Handlers.requestHandler() at the beginning of the middleware stack and Sentry.Handlers.errorHandler() at the end.
  • User Context: Updated the authenticate and optionalAuthenticate middlewares to automatically enrich Sentry events with user IDs and emails.
  • Environment: Updated .env.example with the required Sentry configuration variables.

Client (/client)

  • Sentry Next.js SDK: Installed @sentry/nextjs.
  • Unified Config: Created sentry.client.config.ts, sentry.server.config.ts, and sentry.edge.config.ts.
  • Build Integration: Wrapped next.config.mjs with withSentryConfig to enable automatic source map uploads and build-time instrumentation.
  • Environment: Added NEXT_PUBLIC_SENTRY_DSN and deployment variables to .env.example.

Stability and Fixes

During verification, several pre-existing issues were identified and resolved to ensure a clean build and reliable monitoring:

  • Backend: Fixed a syntax error in risk-detection-service.ts.
  • Client:
    • Fixed duplicate imports and syntax garbage in subscriptions.tsx.
    • Resolved a TypeScript type mismatch in cancellation-guide-modal.tsx.
    • Fixed a visibility access error and duplication in audit-log.ts.

Verification

  • Verified backend initialization and middleware placement.
  • Verified client configuration and build-time wrapping.
  • Successfully completed production builds (npm run build) in both directories following the fixes.

Next Steps

  1. Add SENTRY_DSN, SENTRY_ORG, and SENTRY_PROJECT to the production .env files.
  2. Generate a SENTRY_AUTH_TOKEN for source map uploads during CI/CD.

Closes #168

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 27, 2026

@Vivian-04 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Vivian-04
Copy link
Copy Markdown
Author

Kindly confirm.

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.

Add Sentry error monitoring for both client and backend

1 participant