Repository navigation
fix(sentry): Prevent NotFoundError from rrweb DOM patches - #4133
sentry[bot] wants to merge 1 commit into
Conversation
|
Seer wants to keep iterating on this pull request to get CI passing, but the Sentry GitHub App installation is missing permissions it needs to read the failing checks and push a fix. Review and accept the updated permissions to let Seer continue: https://github.com/organizations/codecov/settings/installations/86101127/permissions/update |
Bundle ReportChanges will increase total bundle size by 308 bytes (0.0%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: gazebo-production-esmAssets Changed:
Files in
view changes for bundle: gazebo-production-systemAssets Changed:
Files in
|
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #4133 +/- ##
=======================================
Coverage 98.77% 98.77%
=======================================
Files 823 823
Lines 15147 15147
Branches 4387 4387
=======================================
Hits 14961 14961
Misses 179 179
Partials 7 7
Continue to review full report in Codecov by Sentry.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4133 +/- ##
=======================================
Coverage 98.77% 98.77%
=======================================
Files 823 823
Lines 15147 15147
Branches 4387 4387
=======================================
Hits 14961 14961
Misses 179 179
Partials 7 7
Continue to review full report in Codecov by Harness.
|
✅ Deploy preview for gazebo ready!Previews expire after 1 month automatically.
|
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #4133 +/- ##
=======================================
Coverage 98.77% 98.77%
=======================================
Files 823 823
Lines 15147 15147
Branches 4387 4387
=======================================
Hits 14961 14961
Misses 179 179
Partials 7 7
Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
Description
This PR addresses the
NotFoundError: Failed to execute 'insertBefore' on 'Node': The reference node is not a child of this node.occurring on the/loginpage.Root Cause:
The issue stemmed from Sentry Replay's rrweb library monkey-patching native DOM methods (
insertBefore,removeChild). When rrweb failed to initialize properly (due to aTypeError: Cannot redefine property: adoptedStyleSheetslikely caused by another script or browser extension), its broken DOM patches remained active. This led to a desynchronization between React's internal fiber tree and the actual DOM, causinginsertBefore(andremoveChild) operations to fail, particularly when React was trying to insert elements relative to fragile comment-node placeholders generated by Fragment roots during conditional rendering.Code Example
1. Stabilized LoginLayout DOM:
In
src/layouts/LoginLayout/LoginLayout.tsx, the root React Fragment (<>) was replaced with a stable<div>element.2. Filtered Sentry Errors:
In
src/sentry.ts, regex patterns forNotFoundError: Failed to execute 'insertBefore' on 'Node'andNotFoundError: Failed to execute 'removeChild' on 'Node'were added to theignoreErrorslist.Notable Changes
src/layouts/LoginLayout/LoginLayout.tsx, the root React Fragment (<>) was replaced with a stable<div>element. This ensures that React's DOM mutations, especially for conditionally rendered components like<SessionExpiredBanner />, use a concrete DOM element as an anchor, making them more resilient to external DOM manipulation issues caused by rrweb's broken patches.src/sentry.ts, regex patterns forNotFoundError: Failed to execute 'insertBefore' on 'Node'andNotFoundError: Failed to execute 'removeChild' on 'Node'were added to theignoreErrorslist. This prevents these specific third-party DOM manipulation errors (which are not indicative of application bugs) from being reported to Sentry, reducing noise and focusing error tracking on actionable issues.Screenshots
Link to Sample Entry
Legal Boilerplate
Look, I get it. The entity doing business as "Codecov" is owned by Harness, Inc. In 2026 Harness acquired Codecov and as a result Harness is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Harness can use, modify, copy, and redistribute my contributions, under Harness's choice of terms.
Fixes GAZEBO-187E
@sentry <feedback>: Autofix iterates on these changes@sentry stop iterating: Autofix stops iterating on this runThis PR was automatically generated by Sentry. You can adjust this setting at any time.