refactor: move umami and sentry to server side

This commit is contained in:
2026-02-07 09:58:31 +01:00
parent 51b44b43ad
commit 56b27b26bc
15 changed files with 250 additions and 104 deletions

View File

@@ -1,13 +1,19 @@
import * as Sentry from '@sentry/nextjs';
const dsn = process.env.SENTRY_DSN;
// We use a placeholder DSN on the client because the real DSN is injected
// by our server-side relay at /errors/api/relay.
// This keeps our environment clean of NEXT_PUBLIC_ variables.
const CLIENT_DSN = 'https://public@errors.infra.mintel.me/1';
Sentry.init({
dsn,
enabled: Boolean(dsn),
dsn: CLIENT_DSN,
// Relay events through our own server to hide the real DSN and bypass ad-blockers
tunnel: '/errors/api/relay',
// Enable even if no DSN is provided, because we have the tunnel
enabled: true,
tracesSampleRate: 0,
// AdjustingreplaysOnErrorSampleRate to 1.0 to capture 100% of errors with replays if enabled
replaysOnErrorSampleRate: 1.0,
replaysSessionSampleRate: 0.1,
});