Skip to content

[replay]: rrweb addNode crashes on non-extensible DOM nodes #18590

@Kobby-Bawuah

Description

@Kobby-Bawuah

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/nextjs

SDK Version

9.31.0

Framework Version

No response

Link to Sentry event

No response

Reproduction Example/SDK Setup

No reproduction repo available yet. Reporter will provide additional context.

Error occurs when Session Replay is enabled and certain DOM nodes are non-extensible.

Steps to Reproduce

  1. Initialize Sentry with Session Replay enabled
  2. Have a page where certain DOM nodes are frozen/sealed (possibly by third-party scripts)
  3. Observe error in console

Expected Result

Replay should gracefully handle non-extensible DOM nodes without throwing uncaught errors.

Actual Result

Uncaught TypeError: Cannot add property __ln, object is not extensible
at lz.addNode (index.js:1834:1)
at i (index.js:1930:1)
at lJ.emit (index.js:2013:1)
at lJ.processMutations (index.js:1905:1)
at MutationObserver. (index.js:2418:1)

This error cascades and can affect other tools on the page.

See internal ticket for more info.

Additional Context

The addNode function in rrweb attempts to set n2.__ln = node without try/catch protection. When encountering DOM nodes that have been made non-extensible (via Object.freeze(), Object.seal(), or Object.preventExtensions()), this throws an uncaught TypeError.

The errorHandler in the integration handles frozen error objects, but not frozen DOM nodes in addNode.

Reporter indicates this started suddenly without SDK updates, suggesting environmental factors (third-party scripts) may be freezing DOM nodes.

Priority

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions