diff --git a/src/router.tsx b/src/router.tsx index fc00c99e..0e2a859a 100644 --- a/src/router.tsx +++ b/src/router.tsx @@ -87,6 +87,14 @@ export function getRouter() { errorMessage.includes('null is not an object') || errorMessage.includes('is not a function') + // Check for specific Publift Fuse container errors that occur during race conditions + // These errors happen when Fuse library tries to access DOM elements before they're ready + // Pattern: "null is not an object (evaluating 'this.getContainer().ownerDocument')" + const isFuseContainerError = + errorMessage.includes('getContainer') && + errorMessage.includes('ownerDocument') && + errorMessage.includes('null is not an object') + if (hasAdScriptFrame && hasExpectedErrorMessage) { // Suppress the error - log to console in debug mode console.debug( @@ -97,6 +105,16 @@ export function getRouter() { return null // Don't send to Sentry } + // Also suppress Fuse container errors even if they don't have ad script frames + // (the error may be reported from the page context rather than the external script) + if (isFuseContainerError) { + console.debug( + 'Suppressed Publift Fuse container error:', + errorMessage, + ) + return null // Don't send to Sentry + } + return event }, })