Skip to main content

Error Alerting Policy

Sentry alert rules (configure in Sentry dashboard)

1. Error rate spike — critical

Trigger: > 10 new errors in 5 minutes
Action: Email + Slack #alerts
Query: level:error environment:production

2. New issue — high severity

Trigger: Any new issue with level = fatal or error
Action: Email immediately
Filter: environment:production

3. Performance regression — p95 latency

Trigger: p95 transaction duration > 3000ms for /api/*
Action: Email

4. Cron job failure

Trigger: Any error in transaction GET /api/cron/*
Action: Email
Note: Vercel Cron fires at 2:30 UTC and 13:30 UTC daily

5. Auth errors

Trigger: > 5 events matching supabase.auth in 10 minutes
Action: Slack #security-alerts

Sentry configuration (already in codebase)

sentry.server.config.ts, sentry.client.config.ts, sentry.edge.config.ts — Sentry is wired. To add environment tagging, update sentry.server.config.ts:

Uptime monitoring

Use the /api/health endpoint with an external monitor: Alert condition: HTTP status ≠ 200 OR response contains "status":"error".

On-call rotation

Since this is a single-team product, a simple escalation path:
  1. Automated alert fires → Slack/email
  2. No ack in 15 min → WhatsApp to primary dev
  3. No ack in 30 min → call secondary dev
Suggested tool: PagerDuty free tier (1 on-call user, unlimited alerts).

Incident runbook

  1. Check /api/health → identify failing component
  2. Check Vercel Functions logs for the affected route
  3. Check Supabase dashboard → Database → Logs for DB errors
  4. If DB: check connection pool usage (Supabase → Database → Connection Pooling)
  5. Roll back last deploy if needed: Vercel dashboard → Deployments → Promote previous