Skip to content

Commit 7a50e26

Browse files
Ajit Pratap Singhclaude
authored andcommitted
fix(website): expand Sentry error filters to suppress hydration and pushState noise
- Add ignoreErrors array covering React hydration errors (#418, #423, #425), pushState read-only variants, and Chrome DevTools Protocol messages - Broaden beforeSend pushState filter from exact string to case-insensitive toLowerCase().includes("pushstate") to catch all TypeError variants (#434) - Add belt-and-suspenders beforeSend hydration check for events that bypass ignoreErrors (e.g. unhandledrejection without exception value) (#437) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent e87c1dc commit 7a50e26

File tree

1 file changed

+39
-10
lines changed

1 file changed

+39
-10
lines changed

website/src/instrumentation-client.ts

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,54 @@ Sentry.init({
1212
integrations: [
1313
Sentry.replayIntegration(),
1414
],
15+
// Suppress known-noisy error patterns that are not actionable app bugs.
16+
// These originate from browser extensions, React hydration with Replay,
17+
// and Chrome DevTools Protocol messages.
18+
ignoreErrors: [
19+
// pushState read-only — extensions (Vue/Redux DevTools) wrap history.pushState before our app loads.
20+
// Covers all variants: with/without object descriptor suffix, case differences.
21+
/Cannot assign to read only property ['"]?pushState['"]?/i,
22+
// React hydration mismatches triggered by Sentry Replay injecting DOM attributes.
23+
"Text content does not match server-rendered HTML",
24+
"Hydration failed because the server rendered HTML didn't match the client",
25+
"There was an error while hydrating",
26+
"Minified React error #418",
27+
"Minified React error #423",
28+
"Minified React error #425",
29+
// Chrome DevTools Protocol messages from extensions interacting with CodeMirror/Monaco.
30+
/Object Not Found Matching Id:\d+/,
31+
],
1532
beforeSend(event) {
1633
const msg = event.exception?.values?.[0]?.value ?? "";
1734

18-
// Drop known browser-extension noise that cannot be fixed in app code:
35+
// Belt-and-suspenders: also filter in beforeSend for events that bypass
36+
// ignoreErrors (e.g. unhandledrejection events, events with no exception value).
37+
//
38+
// 1. pushState read-only — extensions (Vue/Redux DevTools, privacy tools) wrap
39+
// history.pushState before our app loads, making it read-only. Not
40+
// reproducible without the extension. Covers all TypeError variants (#434).
1941
//
20-
// 1. "Cannot assign to read only property 'pushState'" — extensions
21-
// (Vue/Redux DevTools, privacy tools) wrap history.pushState before our
22-
// app loads, making it read-only. Not reproducible without the extension.
42+
// 2. React hydration errors — triggered by Sentry Replay injecting data-*
43+
// attributes into the DOM. React compares server HTML (no attrs) with client
44+
// HTML (Sentry attrs) → mismatch. Not a real app bug (#437).
2345
//
24-
// 2. "Object Not Found Matching Id:N, MethodName:update" — Chrome DevTools
25-
// Protocol messages from extensions interacting with CodeMirror/Monaco.
26-
// The error originates outside our code and only affects a single session.
46+
// 3. "Object Not Found Matching Id:N" — Chrome DevTools Protocol messages from
47+
// extensions interacting with CodeMirror/Monaco. Outside our code.
2748
const isExtensionNoise =
28-
msg.includes("Cannot assign to read only property 'pushState'") ||
49+
msg.toLowerCase().includes("pushstate") ||
2950
msg.includes("Object Not Found Matching Id:");
3051

31-
if (isExtensionNoise) {
52+
const isHydrationNoise =
53+
msg.includes("Text content does not match") ||
54+
msg.includes("Hydration failed") ||
55+
msg.includes("There was an error while hydrating") ||
56+
msg.includes("Minified React error #418") ||
57+
msg.includes("Minified React error #423") ||
58+
msg.includes("Minified React error #425");
59+
60+
if (isExtensionNoise || isHydrationNoise) {
3261
if (process.env.NODE_ENV === "development") {
33-
console.debug("[Sentry] Suppressed extension noise:", msg);
62+
console.debug("[Sentry] Suppressed noise:", msg);
3463
}
3564
return null;
3665
}

0 commit comments

Comments
 (0)