easy-invoice-pdf/sentry.client.config.ts
VladSez 549fed296c chore: update package manager and Playwright timeout settings; enhance Sentry configuration for better environment checks
- Updated package manager version from pnpm@10.6.5 to pnpm@10.9.0 in package.json.
- Increased Playwright expect assertion timeout from 15 seconds to 25 seconds for improved test reliability.
- Refactored Sentry configuration in client, edge, and server files to utilize environment checks for enabling Sentry and DSN management, ensuring better performance and clarity in production environments.
2025-04-23 23:42:07 +02:00

35 lines
1.2 KiB
TypeScript

// This file configures the initialization of Sentry on the client.
// The config you add here will be used whenever a users loads a page in their browser.
// https://docs.sentry.io/platforms/javascript/guides/nextjs/
import * as Sentry from "@sentry/nextjs";
const isCI = process.env.CI === "true";
// Check if we're on a Vercel preview deployment, we want to run only on prod domain
const isVercelPreview =
typeof window !== "undefined" &&
window.location.hostname.includes(".vercel.app");
// This is the client config, so we need to check the NEXT_PUBLIC_SENTRY_ENABLED environment variable
const isSentryEnabled =
process.env.NEXT_PUBLIC_SENTRY_ENABLED === "true" &&
!isCI &&
!isVercelPreview;
if (isSentryEnabled) {
Sentry.init({
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
enabled: isSentryEnabled,
// Adjust sampling in production for better performance/cost balance
tracesSampleRate: 0.15, // Sample 15% of transactions
// Recommended production settings
debug: false,
// Performance settings
replaysSessionSampleRate: 0.1, // Sample 10% of sessions
replaysOnErrorSampleRate: 1.0, // But capture all sessions with errors
});
}