Skip to content

Sentry

Sentry vangt runtime errors en performance data op in alle drie Beam apps. Elke app gebruikt een eigen Sentry library afgestemd op het runtime-environment.

AppLibraryRuntime
Dashboard@sentry/reactBrowser (React 19)
APItoucan-jsCloudflare Workers (V8 isolate)
Public Site@sentry/astroCloudflare Pages (Astro SSR)
  • Initialisatie: In main.tsx, vóór React render
  • Source maps: Upload bij build via Vite plugin (@sentry/vite-plugin)
  • React 19: Compatible via @sentry/react v8+
  • Context: User ID wordt gezet na auth
  • Initialisatie: Als Hono middleware (eerste in de stack)
  • Request context: Request ID, user ID, method, path worden meegestuurd
  • Error boundaries: Alle uncaught exceptions in route handlers worden gevangen
  • Performance: Request duration tracking

De standaard @sentry/node SDK werkt niet in Cloudflare Workers (geen Node.js runtime). toucan-js is specifiek gebouwd voor de Workers V8 isolate omgeving.

  • Initialisatie: Via Astro integratie
  • SSR errors: Server-side rendering fouten worden gevangen
  • Source maps: Upload bij build
VariabeleWaarType
VITE_SENTRY_DSNDashboardBuild-time
SENTRY_DSNAPI WorkerSecret
SENTRY_DSNPublic SiteBuild-time

Alle drie apps gebruiken hetzelfde Sentry project maar verschillende DSN’s voor environment scheiding.

TypeWaarDoel
Structured JSON logsAPI Worker consoleRequest tracing, performance
Sentry eventsSentry dashboardErrors, crashes, exceptions

Sentry vangt alleen errors — structured logging (via de API logger middleware) logt alle requests met timing en status.

ProbleemOorzaakOplossing
Source maps niet resolvedUpload mislukt bij buildCheck SENTRY_AUTH_TOKEN in CI/CD
Workers errors niet zichtbaartoucan-js niet als eerste middlewareVerplaats naar boven in middleware stack
Duplicate eventsZowel catch als middleware vangenGebruik captureException alleen in catch