Skip to content

Sprint 3 batch 2: Sentry integration (opt-in) - #130

Merged
keysersoft merged 1 commit into
mainfrom
keysersoft/sentry
May 3, 2026
Merged

keysersoft merged 1 commit into
mainfrom
keysersoft/sentry

Conversation

@keysersoft

Copy link
Copy Markdown
Contributor

Backend (@sentry/nestjs) and frontend (@sentry/nextjs) error reporting wired in. All four init paths read SENTRY_DSN / NEXT_PUBLIC_SENTRY_DSN and short-circuit when unset, so the default self-hosted experience ships nothing to Sentry. Sample rates default to 0 — operators must opt in explicitly.

Sensitive headers and DTO field names are scrubbed in the backend beforeSend so credential leaks can't reach Sentry even if a controller logs its body.

Verified: backend 554/555, Playwright 3/3, both tsc clean.

Backend: src/instrument.ts initialises @sentry/nestjs before any other
application code so the auto-instrumentation can wrap http/express/prisma.
beforeSend strips authorization/cookie/x-api-key/set-cookie headers and
any *password* / *token* / *secret* / *apiKey* / *credential* nested key
from the event body. main.ts imports it before NestFactory.create.

Frontend: sentry.{client,server,edge}.config.ts plus src/instrumentation.ts
delegating to the right runtime. onRequestError captures errors thrown by
RSCs / route handlers; a defensive wrapper means a missing
captureRequestError helper in older Sentry versions doesn't break the
build.

All four init paths read SENTRY_DSN (or NEXT_PUBLIC_SENTRY_DSN on the
client) and short-circuit when unset, so the default self-hosted
experience ships zero traffic to Sentry. tracesSampleRate /
profilesSampleRate / replaysSampleRate default to 0 and require the
operator to set the corresponding env vars to opt in.

Verified: backend jest 554/555 pass, frontend Playwright 3/3 pass,
both tsc --noEmit clean. Full Docker smoke deferred to the end-of-sprint
final run.
@keysersoft
keysersoft merged commit fea954f into main May 3, 2026
8 of 9 checks passed
@keysersoft
keysersoft deleted the keysersoft/sentry branch May 12, 2026 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant