From 8588cc03f4847a3d2312ef243c81231d4abb88fd Mon Sep 17 00:00:00 2001 From: Alan Buscaglia Date: Wed, 10 Dec 2025 16:02:04 +0100 Subject: [PATCH] fix(ui): use Sentry namespace for browserTracingIntegration (#9503) --- ui/app/instrumentation.client.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ui/app/instrumentation.client.ts b/ui/app/instrumentation.client.ts index 689eab3e79..a9abf3f345 100644 --- a/ui/app/instrumentation.client.ts +++ b/ui/app/instrumentation.client.ts @@ -1,3 +1,5 @@ +"use client"; + /** * Client-side Sentry instrumentation * @@ -9,12 +11,11 @@ */ import * as Sentry from "@sentry/nextjs"; -import { browserTracingIntegration } from "@sentry/nextjs"; const SENTRY_DSN = process.env.NEXT_PUBLIC_SENTRY_DSN; -// Only initialize Sentry if DSN is configured -if (SENTRY_DSN) { +// Only initialize Sentry in the browser (not during SSR) +if (typeof window !== "undefined" && SENTRY_DSN) { const isDevelopment = process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT === "local"; /** @@ -43,12 +44,12 @@ if (SENTRY_DSN) { tracesSampleRate: isDevelopment ? 1.0 : 0.5, profilesSampleRate: isDevelopment ? 1.0 : 0.5, - // 🔌 Integrations + // 🔌 Integrations - browserTracingIntegration is client-only integrations: [ // 📊 Performance Monitoring: Core Web Vitals + RUM // Tracks LCP, FID, CLS, INP // Real User Monitoring captures actual user experience, not synthetic tests - browserTracingIntegration({ + Sentry.browserTracingIntegration({ enableLongTask: true, // Detect tasks that block UI (>50ms) enableInp: true, // Interaction to Next Paint (Core Web Vital) }),