26 lines
781 B
TypeScript
26 lines
781 B
TypeScript
|
|
/**
|
||
|
|
* Sentry client-side init.
|
||
|
|
*
|
||
|
|
* No-op when `NEXT_PUBLIC_SENTRY_DSN` is unset — Sentry stays
|
||
|
|
* shipped-but-dormant in dev. Production sets the DSN via the
|
||
|
|
* deploy env. Sampling rate is env-driven via
|
||
|
|
* `SENTRY_TRACES_SAMPLE_RATE` (defaults to 0.1 = 10% of transactions
|
||
|
|
* to avoid quota burn).
|
||
|
|
*/
|
||
|
|
|
||
|
|
import * as Sentry from '@sentry/nextjs';
|
||
|
|
|
||
|
|
const dsn = process.env.NEXT_PUBLIC_SENTRY_DSN;
|
||
|
|
|
||
|
|
if (dsn) {
|
||
|
|
Sentry.init({
|
||
|
|
dsn,
|
||
|
|
environment: process.env.SENTRY_ENVIRONMENT ?? process.env.NODE_ENV,
|
||
|
|
tracesSampleRate: Number(process.env.SENTRY_TRACES_SAMPLE_RATE ?? 0.1),
|
||
|
|
// Replay is opt-in — we'd need to verify privacy implications
|
||
|
|
// before enabling. Leave disabled by default.
|
||
|
|
replaysOnErrorSampleRate: 0,
|
||
|
|
replaysSessionSampleRate: 0,
|
||
|
|
});
|
||
|
|
}
|