19 lines
468 B
TypeScript
19 lines
468 B
TypeScript
|
|
/**
|
||
|
|
* Sentry server-side init.
|
||
|
|
*
|
||
|
|
* No-op when `NEXT_PUBLIC_SENTRY_DSN` is unset. Same DSN as the client
|
||
|
|
* config — Sentry routes events to the right project automatically.
|
||
|
|
*/
|
||
|
|
|
||
|
|
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),
|
||
|
|
});
|
||
|
|
}
|