Skip to content

Commit edcafbd

Browse files
Mlaz-codeclaude
andauthored
fix(observability): match minified React error format in PostHog filter (SHA-2377) (#220)
SHA-2240 (commit 25b7d89) shipped suppressHydrationWarning at the DOM level + IGNORED_PATTERNS for unminified hydration error messages. But production builds minify React errors as "Minified React error #N; visit https://react.dev/errors/N..." — the form PostHog actually captures from production users. PostHog 14d audit (2026-05-08): docs continued to ingest ~125 React #418 hits across 84 distinct users after the SHA-2240 fix — all in the minified format that the existing patterns don't match. Two changes: 1. Add /Minified React error #(310|418|423|425)/ to IGNORED_PATTERNS so production-minified React errors are filtered alongside the un-minified dev-build versions. 2. Generalize the prism_bash_exports special-case to /prism_\w+_exports/ plus /Export 'prism_/ + /local binding for export 'prism_/. Same root cause (PrismJS-based browser extensions injecting into the page); the audit showed prism_python_exports also firing alongside prism_bash. Pure analytics-filter change; no runtime behavior modified. Underlying hydration suppression from SHA-2240 still in place at the DOM layer. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent c7a759e commit edcafbd

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

components/PostHogProvider.tsx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,19 @@ const IGNORED_PATTERNS = [
1212
/moz-extension:\/\//,
1313
/ChunkLoadError/,
1414
/Loading chunk/,
15-
/prism_bash_exports/, // browser extension (PrismJS-based dev tools) injecting into the page
16-
// React hydration errors (#418, #423, #425) — mismatches are from Nextra internals
17-
// (next-themes localStorage reads, Switchers conditional rendering). Suppressed at
18-
// the DOM level via suppressHydrationWarning; PostHog sees them as noise.
15+
// PrismJS-based browser extensions inject a global Prism whose dynamic-import
16+
// chunks fail to resolve. Generalized from the prism_bash_exports special-case
17+
// shipped in SHA-2240 to also cover prism_python_exports and future variants.
18+
/prism_\w+_exports/,
19+
/Export 'prism_/,
20+
/local binding for export 'prism_/,
21+
// React hydration/render errors (#418, #423, #425) — mismatches are from Nextra
22+
// internals (next-themes localStorage reads, Switchers conditional rendering).
23+
// Suppressed at the DOM level via suppressHydrationWarning. The unminified-message
24+
// patterns below remain for dev/local builds; production minification emits as
25+
// "Minified React error #N" — that's the form PostHog actually captures, so we
26+
// need to match both shapes.
27+
/Minified React error #(310|418|423|425)/,
1928
/Hydration failed/,
2029
/There was an error while hydrating/,
2130
/Text content did not match/,

0 commit comments

Comments
 (0)