Skip to content

Commit d9a086d

Browse files
authored
fix: Enhance error suppression for Publift Fuse container race conditions
1 parent 8aa0fc2 commit d9a086d

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

src/router.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,14 @@ export function getRouter() {
8787
errorMessage.includes('null is not an object') ||
8888
errorMessage.includes('is not a function')
8989

90+
// Check for specific Publift Fuse container errors that occur during race conditions
91+
// These errors happen when Fuse library tries to access DOM elements before they're ready
92+
// Pattern: "null is not an object (evaluating 'this.getContainer().ownerDocument')"
93+
const isFuseContainerError =
94+
errorMessage.includes('getContainer') &&
95+
errorMessage.includes('ownerDocument') &&
96+
errorMessage.includes('null is not an object')
97+
9098
if (hasAdScriptFrame && hasExpectedErrorMessage) {
9199
// Suppress the error - log to console in debug mode
92100
console.debug(
@@ -97,6 +105,16 @@ export function getRouter() {
97105
return null // Don't send to Sentry
98106
}
99107

108+
// Also suppress Fuse container errors even if they don't have ad script frames
109+
// (the error may be reported from the page context rather than the external script)
110+
if (isFuseContainerError) {
111+
console.debug(
112+
'Suppressed Publift Fuse container error:',
113+
errorMessage,
114+
)
115+
return null // Don't send to Sentry
116+
}
117+
100118
return event
101119
},
102120
})

0 commit comments

Comments
 (0)