Skip to content

Commit

Permalink
refactor: disable warning when disable sentry
Browse files Browse the repository at this point in the history
  • Loading branch information
dulapahv committed Dec 26, 2024
1 parent 3f4608b commit 1212ead
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions client/src/instrumentation.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import * as Sentry from '@sentry/nextjs';

const isCi = process.env.CI === 'true';

export async function register() {
if (process.env.NEXT_RUNTIME === 'nodejs') {
await import('../sentry.server.config');
}
if (!isCi) {
if (process.env.NEXT_RUNTIME === 'nodejs') {
await import('../sentry.server.config');
}

if (process.env.NEXT_RUNTIME === 'edge') {
await import('../sentry.edge.config');
if (process.env.NEXT_RUNTIME === 'edge') {
await import('../sentry.edge.config');
}
}
}

export const onRequestError = Sentry.captureRequestError;
// Only capture errors when not in CI
export const onRequestError = isCi ? undefined : Sentry.captureRequestError;

0 comments on commit 1212ead

Please sign in to comment.