[Bug]: Cannot use 'in' operator to search for 'xmlns' in undefined
w3villa-harsh-yadav opened this issue · comments
Preflight Checklist
- I have searched the issue tracker for a bug report that matches the one I want to file, without success.
What package is this bug report for?
rrweb-player
Version
^1.0.0-alpha.4
Expected Behavior
I want the video to be played which is recorded using rrweb package
Actual Behavior
The video recorded using rrweb package is showing blank screen during its playtime, and throwing this error.
Steps to Reproduce
Try Recording for this website https://research-laundry.github.io/test.html
Testcase Gist URL
No response
Additional Information
rrweb-snapshot.js:1728 Uncaught TypeError: Cannot use 'in' operator to search for 'xmlns' in undefined
at ra (rrweb-snapshot.js:1728:17)
at rrweb-snapshot.js:1801:16
at ol.rebuildFullSnapshot (index.js:515:9)
at index.js:340:22
Thanks for the bug report.
When I make a recording of your website via yarn repl
I get the following DOM structure:
{"type":2,
"data":{"node":{"type":0,
"childNodes":[{"type":2,
"tagName":"html",
"attributes":{},
"childNodes":[{"type":2,
"tagName":"head",
"attributes":{},
"childNodes":[{"type":3,
"textContent":"\n\t\t",
"id":4}
And don't get any error.
All of the nodes have an empty attributes
object (your TypeError is complaining about attributes being undefined)
Is it possible that you are doing some server side processing of the rrewb data?
This would be a fix btw, but don't think it's needed in trunk, but I may be wrong;
+++ b/packages/rrweb-snapshot/src/rebuild.ts
@@ -439,6 +439,7 @@ export function buildNodeWithSN(
// this is needed as document.createElement('iframe') otherwise inherits a CSS1Compat mode from the parent replayer environment
if (
n.childNodes[0].type === NodeType.Element &&
+ n.childNodes[0].attributes &&
'xmlns' in n.childNodes[0].attributes &&
n.childNodes[0].attributes.xmlns === 'http://www.w3.org/1999/xhtml'
) {
@eoghanmurray Appreciate your response. While recording sessions, I haven't encountered any errors. However, I'm encountering playback issues specifically with rrweb-player, and it seems to be isolated to a particular website. This suggests there might be an issue with how rrweb captures the DOM for this site. Can you please tell if that can be fixed or is there any alternate for this issue.
So as mentioned I've checked with yarn repl
against the website you referenced but could not recreate.
Could you do the same with your installation of rrweb — 1.0.0-alpha.4 — I'm running off trunk so I think that's a little ahead of you.
General instructions:
Line 30 in 729361e
I also queried whether you are doing any postprocessing of events?
@eoghanmurray Thank you for your response. I haven't encountered any errors while recording and saving the DOM structure to my backend. However, I'm experiencing issues with playback using rrweb-player. I'll also attempt playback using the trunk version. Regarding post-processing, I'm not currently performing any post-processing on the data.
Could you let me know what the resolution on this was? Did the current version of trunk fix it?