Commit 3edfa98
[dev] [Marfuen] mariano/sentry-integration (#2708)
* feat(observability): integrate Sentry into app and portal
Wire @sentry/nextjs into apps/app (via wizard) and apps/portal (manual setup
mirroring the wizard). Both apps push to Sentry org=comp-ai, project=comp.
- Add server, edge, and client init files plus instrumentation.ts in both apps
- Wrap each app's next.config.ts with withSentryConfig (tunnelRoute /monitoring,
widenClientFileUpload, source map upload, debug-log treeshake)
- Use env-var-driven DSN with the literal as fallback so dev still works without
setup, and gate tracesSampleRate by NODE_ENV (1.0 dev / 0.1 prod)
- Set includeLocalVariables on server init for richer stack frames
- Capture render errors via Sentry.captureException in both global-error.tsx
- Consolidate apps/app instrumentation-client.ts to src/, merging the existing
botid init alongside Sentry init (avoids Next.js loading only one of two)
- Place the wizard's sample page inside the [orgId] route group so it isn't
redirected by the org-scoped layout
Source maps require SENTRY_AUTH_TOKEN to be set in Vercel env (Production +
Preview) for both projects; same token works since it's org-scoped.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* chore(turbo): allow Sentry env vars through to next build
Turbo filters env vars to only what's listed in globalEnv. Without this,
the Sentry webpack plugin can't see SENTRY_AUTH_TOKEN at build time and
silently skips source map upload + release creation, even when the var is
set in Vercel.
Adds NEXT_PUBLIC_SENTRY_DSN, SENTRY_AUTH_TOKEN, SENTRY_DSN to globalEnv.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(sentry): drop sendDefaultPii and remove example pages
P1 from cubic review: Sentry's sendDefaultPii: true auto-attaches IPs,
cookies, and request headers to every event sent to a third-party
processor. For a compliance product that's not the right default; turn
it off across all six init files (server, edge, client × app, portal).
Per-user attribution can still be added explicitly via Sentry.setUser.
P2 from cubic review: the wizard's sentry-example-page used next/head
which doesn't work in App Router. Page was scaffolding intended for
deletion before merge anyway — removed both the page and its companion
API route instead of migrating to the Metadata API.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* revert(sentry): re-enable sendDefaultPii across both apps
Reversing the conservative default after team review: app does not
collect SSN-style typed PII, and IP / user-agent / cookie context is
useful for debugging real production incidents. Sentry's default ingest
scrubbers continue to mask Authorization, Cookie, and X-Api-Key by key;
session replay still masks <input type="password"> by default.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Mariano <marfuen98@gmail.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 0aa2417 commit 3edfa98
6 files changed
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
16 | 18 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
17 | 19 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
36 | 38 | | |
37 | 39 | | |
38 | 40 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
| 17 | + | |
16 | 18 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
17 | 19 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
0 commit comments