From 0b331c6c4ebab353bea5c6b1dfc73249f8a2f7c4 Mon Sep 17 00:00:00 2001 From: "seer-by-sentry[bot]" <157164994+seer-by-sentry[bot]@users.noreply.github.com> Date: Tue, 30 Sep 2025 13:39:09 +0000 Subject: [PATCH] Fix: Handle and filter browser extension errors in client hints and Sentry --- .../workshop-app/app/utils/client-hints.tsx | 22 ++++++++++++++++++- .../app/utils/monitoring.client.ts | 17 ++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/packages/workshop-app/app/utils/client-hints.tsx b/packages/workshop-app/app/utils/client-hints.tsx index 3869e229..3ad7445d 100644 --- a/packages/workshop-app/app/utils/client-hints.tsx +++ b/packages/workshop-app/app/utils/client-hints.tsx @@ -60,10 +60,30 @@ export function ClientHintCheck() { [revalidate], ) + // Wrap the client hint check script in a try-catch to handle browser extension global variable errors + const safeClientHintScript = ` + try { + ${hintsUtils.getClientHintCheckScript()} + } catch (error) { + // Ignore errors from browser extension global variables like __firefox__, window.ethereum, etc. + if (error instanceof ReferenceError && ( + error.message.includes('__firefox__') || + error.message.includes('ethereum') || + error.message.includes('chrome') || + error.message.includes('browser') + )) { + // Browser extension global not available, continue normally + return; + } + // Re-throw other errors + throw error; + } + ` + return (