Skip to content

Commit dd35c3a

Browse files
Ajit Pratap Singhclaude
authored andcommitted
fix(website): deduplicate Sentry error patterns, narrow pushState filter
Extract PUSHSTATE_REGEX as a shared constant used by both ignoreErrors and beforeSend, eliminating duplication. Replace overly broad msg.toLowerCase().includes("pushstate") with PUSHSTATE_REGEX.test(msg) to avoid suppressing legitimate errors that happen to mention pushState. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 36b8d02 commit dd35c3a

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

website/src/instrumentation-client.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ import * as Sentry from "@sentry/nextjs";
22

33
const dsn = process.env.NEXT_PUBLIC_SENTRY_DSN;
44

5+
// Shared regex for pushState read-only errors caused by browser extensions
6+
// (Vue/Redux DevTools, privacy tools) wrapping history.pushState before our app loads.
7+
const PUSHSTATE_REGEX = /Cannot assign to read only property ['"]?pushState['"]?/i;
8+
59
Sentry.init({
610
dsn,
711
sendDefaultPii: true,
@@ -16,9 +20,8 @@ Sentry.init({
1620
// These originate from browser extensions, React hydration with Replay,
1721
// and Chrome DevTools Protocol messages.
1822
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,
23+
// pushState read-only — covers all TypeError variants (#434).
24+
PUSHSTATE_REGEX,
2225
// React hydration mismatches triggered by Sentry Replay injecting DOM attributes.
2326
"Text content does not match server-rendered HTML",
2427
"Hydration failed because the server rendered HTML didn't match the client",
@@ -46,7 +49,7 @@ Sentry.init({
4649
// 3. "Object Not Found Matching Id:N" — Chrome DevTools Protocol messages from
4750
// extensions interacting with CodeMirror/Monaco. Outside our code.
4851
const isExtensionNoise =
49-
msg.toLowerCase().includes("pushstate") ||
52+
PUSHSTATE_REGEX.test(msg) ||
5053
msg.includes("Object Not Found Matching Id:");
5154

5255
const isHydrationNoise =

0 commit comments

Comments
 (0)