Skip to content

Commit 3edfa98

Browse files
github-actions[bot]Marfuenclaude
authored
[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

File tree

apps/app/sentry.edge.config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,6 @@ Sentry.init({
1313
tracesSampleRate: process.env.NODE_ENV === 'development' ? 1.0 : 0.1,
1414

1515
enableLogs: true,
16+
17+
sendDefaultPii: true,
1618
});

apps/app/sentry.server.config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,6 @@ Sentry.init({
1414
includeLocalVariables: true,
1515

1616
enableLogs: true,
17+
18+
sendDefaultPii: true,
1719
});

apps/app/src/instrumentation-client.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ Sentry.init({
3333
// 10% of all sessions; 100% of sessions where an error occurs.
3434
replaysSessionSampleRate: 0.1,
3535
replaysOnErrorSampleRate: 1.0,
36+
37+
sendDefaultPii: true,
3638
});
3739

3840
export const onRouterTransitionStart = Sentry.captureRouterTransitionStart;

apps/portal/sentry.edge.config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,6 @@ Sentry.init({
1313
tracesSampleRate: process.env.NODE_ENV === 'development' ? 1.0 : 0.1,
1414

1515
enableLogs: true,
16+
17+
sendDefaultPii: true,
1618
});

apps/portal/sentry.server.config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,6 @@ Sentry.init({
1414
includeLocalVariables: true,
1515

1616
enableLogs: true,
17+
18+
sendDefaultPii: true,
1719
});

apps/portal/src/instrumentation-client.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ Sentry.init({
1818
// 10% of all sessions; 100% of sessions where an error occurs.
1919
replaysSessionSampleRate: 0.1,
2020
replaysOnErrorSampleRate: 1.0,
21+
22+
sendDefaultPii: true,
2123
});
2224

2325
export const onRouterTransitionStart = Sentry.captureRouterTransitionStart;

0 commit comments

Comments
 (0)