feat(observability): browser Sentry SDK (gated on VITE_SENTRY_DSN) #68

Merged
root merged 1 commits from feat/sentry-browser into dev 2026-06-01 18:15:12 +03:00
Owner

Adds @sentry/react to the Vite frontend, gated on VITE_SENTRY_DSN. No behaviour change when DSN is unset.

What this fixes

A recent panel investigation (insight cmpv9q3ms004dfcphluw0z8bh — silent rage-clicks after parts_panel_viewed, no API call follows) couldn't be confirmed or refuted from JS error data because sase frontend has no browser error channel. Faro (RUM/traces) and PostHog (product) are wired, Sentry isn't. This adds it.

Changes

  • apps/web/package.json: @sentry/react ^9
  • apps/web/src/lib/sentry.ts: new — dynamic import, no SDK cost when DSN unset
  • apps/web/src/main.tsx: initSentry() called before other init (so it captures their errors too)
  • apps/web/vite.config.ts: sourcemap: 'hidden' so Sentry can de-minify traces (via release upload) without exposing source to end-user browsers
  • docker-compose.coolify.yml: thread VITE_SENTRY_DSN, VITE_SENTRY_ENVIRONMENT, VITE_SENTRY_RELEASE as build args (Vite values must be build-time)

Tuning

  • tracesSampleRate: 0.1 — start conservative, can raise later
  • replaysSessionSampleRate: 0 / replaysOnErrorSampleRate: 1 — only record replay when an error fires
  • sendDefaultPii: false + maskAllText: true + blockAllMedia: true — KVKK compliance
  • ignoreErrors: framework noise (ResizeObserver, etc.)

Post-merge wiring (manual)

  1. Set on prod Coolify app ro48g8ooo0gk4kskog0oo8s8:
    • VITE_SENTRY_DSN=https://683bd4176e870d331d2ac8eba3160ec9@o4508621271203840.ingest.de.sentry.io/4511490774138960
    • VITE_SENTRY_ENVIRONMENT=production
  2. Same on dev jwgwkg4ssks80os0wswckgcs with VITE_SENTRY_ENVIRONMENT=development.
  3. Redeploy both (not restart — Coolify keeps existing container on restart; env-change requires a full redeploy).
  4. Verify in Sentry: events arriving on otolog/sase-web project (id 4511490774138960).

Out of scope (future PRs)

  • Source map upload via @sentry/vite-plugin (needs SENTRY_AUTH_TOKEN in CI)
  • Panel sentry-archive job multi-project support (currently single-project to python)
  • Backend NestJS Sentry on prod (currently only on dev)

🤖 Generated with Claude Code

Adds `@sentry/react` to the Vite frontend, gated on `VITE_SENTRY_DSN`. No behaviour change when DSN is unset. ## What this fixes A recent panel investigation (insight `cmpv9q3ms004dfcphluw0z8bh` — silent rage-clicks after `parts_panel_viewed`, no API call follows) couldn't be confirmed or refuted from JS error data because **sase frontend has no browser error channel**. Faro (RUM/traces) and PostHog (product) are wired, Sentry isn't. This adds it. ## Changes - `apps/web/package.json`: `@sentry/react` ^9 - `apps/web/src/lib/sentry.ts`: new — dynamic import, no SDK cost when DSN unset - `apps/web/src/main.tsx`: `initSentry()` called before other init (so it captures their errors too) - `apps/web/vite.config.ts`: `sourcemap: 'hidden'` so Sentry can de-minify traces (via release upload) without exposing source to end-user browsers - `docker-compose.coolify.yml`: thread `VITE_SENTRY_DSN`, `VITE_SENTRY_ENVIRONMENT`, `VITE_SENTRY_RELEASE` as **build args** (Vite values must be build-time) ## Tuning - `tracesSampleRate: 0.1` — start conservative, can raise later - `replaysSessionSampleRate: 0` / `replaysOnErrorSampleRate: 1` — only record replay when an error fires - `sendDefaultPii: false` + `maskAllText: true` + `blockAllMedia: true` — KVKK compliance - `ignoreErrors`: framework noise (`ResizeObserver`, etc.) ## Post-merge wiring (manual) 1. Set on **prod Coolify app** `ro48g8ooo0gk4kskog0oo8s8`: - `VITE_SENTRY_DSN=https://683bd4176e870d331d2ac8eba3160ec9@o4508621271203840.ingest.de.sentry.io/4511490774138960` - `VITE_SENTRY_ENVIRONMENT=production` 2. Same on **dev** `jwgwkg4ssks80os0wswckgcs` with `VITE_SENTRY_ENVIRONMENT=development`. 3. **Redeploy** both (not restart — Coolify keeps existing container on restart; env-change requires a full redeploy). 4. Verify in Sentry: events arriving on `otolog/sase-web` project (id 4511490774138960). ## Out of scope (future PRs) - Source map upload via `@sentry/vite-plugin` (needs `SENTRY_AUTH_TOKEN` in CI) - Panel `sentry-archive` job multi-project support (currently single-project to `python`) - Backend NestJS Sentry on prod (currently only on dev) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
root changed target branch from main to dev 2026-06-01 18:13:15 +03:00
root added 1 commit 2026-06-01 18:13:15 +03:00
feat(observability): browser Sentry SDK (gated on VITE_SENTRY_DSN)
Some checks failed
QA Gate (P0/P1) / Test affected app (pull_request) Has been cancelled
9f3eb0ff86
Sase frontend has Faro (RUM) and PostHog (product analytics) but no browser
error monitoring. A recent panel session investigation (panel insight
cmpv9q3ms004dfcphluw0z8bh — silent rage-clicks after parts_panel_viewed
with no API call) couldn't be confirmed or refuted from JS error data
because there was no JS error channel at all. This adds one.

- @sentry/react ^9 (dynamic import in lib/sentry.ts so the bundle only
  pays the SDK cost when DSN is configured)
- Init is gated on VITE_SENTRY_DSN — unset = no-op, no behaviour change
- Replay only fires on error (sessionSampleRate 0, onErrorSampleRate 1)
- KVKK: sendDefaultPii false, maskAllText + blockAllMedia on replay
- Builds emit hidden source maps so Sentry can de-minify traces while
  end users don't fetch the maps in the browser
- docker-compose.coolify.yml threads VITE_SENTRY_* through as build args
  (VITE_* must be build-time; runtime env never reaches a Vite bundle)

Wiring on the Coolify side is a separate manual step — set
VITE_SENTRY_DSN on the prod (ro48g…) and/or dev (jwgwkg…) app and
redeploy. Backend Sentry (NestJS) is unchanged.

Refs: Süper Panel docs/ARCHITECTURE.md, panel sentry-archive job.
root force-pushed feat/sentry-browser from 1dbccc706d to 9f3eb0ff86 2026-06-01 18:13:17 +03:00 Compare
root merged commit f4e74908b9 into dev 2026-06-01 18:15:12 +03:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: root/sase.tr#68