-
Notifications
You must be signed in to change notification settings - Fork 2
Minor: No Error Monitoring (Sentry or Similar) #26
Description
Priority
🟡 Minor - Production Reliability
Location
Application-wide - missing error tracking integration
Problem Description
No automated error monitoring in production. Errors are only visible in browser console or server logs.
Current State
Client-Side Errors
Component throws error → Error visible only in browser console, no server notification, no user tracking.
Server-Side Errors
API route fails → Error in server logs only, lost if logs rotate, no alerting.
Issues
1. Invisible Errors
User reports "it's broken", developer asks "what error?", user says "I didn't see one", developer has no information.
2. No Error Context
Error logged but no user info, request info, environment info.
3. No Grouping
Same error from 100 users logged 100 times, should be grouped as 1 issue.
4. No Alerting
Production errors silent, users notice before developers, no SLA monitoring.
5. Lost Errors
Browser console cleared on refresh, server logs rotated after 7 days, historical errors lost.
Expected Behavior
Sentry Integration
Install @sentry/nextjs, configure client/server/edge, add error boundary.
Custom Context
Add user context, request context, custom tags, capture with extra data.
Benefits
1. Real-Time Alerts
Error in production → Slack notification immediately, email to on-call engineer, Jira ticket created.
2. Error Grouping
See error with users affected, occurrences, first seen, last seen, URL.
3. Full Context
User, request, browser, device, memory, release information.
4. Session Replay
Watch user's session leading to error, see exactly what they clicked, reproduce the issue easily.
5. Performance Monitoring
Transaction duration, database time, error rate.
Related Issues
- Critical: .env.example References MongoDB Instead of PostgreSQL #5 - Missing error handling (complementary)
- Minor: Worker Connection Not Cleaned Up on Component Unmount #16 - No structured logging
- Minor: No Health Check or Readiness Endpoints #25 - No metrics/observability
Steps to Fix
Phase 1: Setup
- Create Sentry account (free tier available)
- Create project in Sentry dashboard
- Get DSN (Data Source Name)
- Add DSN to
.env
Phase 2: Integration
- Install
@sentry/nextjs - Configure client/server/edge
- Add error boundary
- Test with intentional error
Phase 3: Context
- Add user context
- Add request context
- Add custom tags
- Set up filtering
Phase 4: Alerts
- Configure Slack notifications
- Set up email alerts
- Define alert thresholds
- Create on-call schedule
Alternatives to Sentry
Free Options
- Sentry (Free: 5k errors/month)
- LogRocket (Free trial)
- Rollbar (Free tier limited)
- Bugsnag (Free trial)
Self-Hosted
- Sentry Self-Hosted (Docker)
- GlitchTip (Open source Sentry alternative)
Simple Options
- Discord webhook (Free)
- Slack webhook (Free)
- Email (Free but noisy)
Additional Context
Error monitoring is essential for production reliability. Without it, you're flying blind - you only know about errors users choose to report (which is ~1% of actual errors).
Cost Considerations
- Sentry Free: 5,000 errors/month
- Sentry Paid: 6/month for 100k errors
- For a learning platform, expect 10-100 errors/day per 1,000 users
Best Practices
- Filter noise: Don't send 404s from bots
- Add context: User, request, environment
- Set alerts: Critical errors wake someone up
- Review regularly: Weekly triage of new issues
- Close issues: Mark resolved when deployed