feat: enable console log recording in session replays#4267
feat: enable console log recording in session replays#4267KAUSHALCODER123 wants to merge 1 commit into
Conversation
|
@KAUSHALCODER123 is attempting to deploy a commit to the Umami Software Team on Vercel. A member of the Team first needs to authorize it. |
|
please accept pull requst |
Greptile SummaryThis PR adds an opt-in "Record console logs" feature to session replays by integrating
Confidence Score: 3/5Two real defects need fixing before merging: the player always shows a console panel even when console recording was disabled, and the rrweb-player major version bump is untested alongside existing replay data. The player unconditionally injects the console replay plugin for all sessions, contradicting the explicit opt-out setting. Combined with an undiscussed major-version upgrade of rrweb-player (1.x to 2.x across 16 alpha releases, with a restructured dependency tree), there is real risk that existing replay functionality regresses for all users. ReplayPlayer.tsx (unconditional plugin injection) and package.json/pnpm-lock.yaml (rrweb-player 1.x to 2.x major bump with dependency restructuring) Important Files Changed
Reviews (1): Last reviewed commit: "feat: enable console log recording in se..." | Re-trigger Greptile |
| speedOption: [1, 2, 4, 8], | ||
| useVirtualDom: false, | ||
| showWarning: false, | ||
| plugins: [getReplayConsolePlugin()], |
There was a problem hiding this comment.
Console replay panel always shown regardless of recording config
getReplayConsolePlugin() is unconditionally injected into every player instance, even for sessions recorded when recordConsole was false (the default). Those sessions contain no console events, so the player will render an empty console panel — contradicting the explicit opt-out. The ReplayPlayer component should receive the recordConsole flag (or derive it from the events list) and conditionally include the plugin.
| "rrweb": "2.0.0-alpha.20", | ||
| "rrweb-player": "2.0.0-alpha.20", |
There was a problem hiding this comment.
rrweb-player major version jump may break existing replay playback
rrweb-player was bumped from 1.0.0-alpha.4 to 2.0.0-alpha.20 — a major-version change across 16 alpha releases. The lock file confirms the new package no longer directly lists rrweb as a dependency; it now pulls in @rrweb/packer and @rrweb/replay instead, indicating significant internal restructuring. Bundling this breaking upgrade with the console-log feature makes it harder to bisect regressions if existing replays stop playing correctly.
|
|
||
| let recorderAttrs = `data-website-id="${websiteId}" data-sample-rate="${sampleRate}" data-mask-level="${maskLevel}" data-max-duration="${parseInt(maxDuration, 10) || 300000}"`; | ||
| if (blockSelector) recorderAttrs += ` data-block-selector="${blockSelector}"`; | ||
| if (recordConsole) recorderAttrs += ` data-record-console="true"`; |
There was a problem hiding this comment.
When
recordConsole is false (the default), the data-record-console attribute is correctly omitted. Consider a strict equality guard to future-proof against accidental inclusion of a falsy string value.
| if (recordConsole) recorderAttrs += ` data-record-console="true"`; | |
| if (recordConsole === true) recorderAttrs += ` data-record-console="true"`; |
| if (recordConsole) { | ||
| plugins.push(getRecordConsolePlugin()); | ||
| } |
There was a problem hiding this comment.
Console logs may capture sensitive data before masking rules apply
getRecordConsolePlugin() intercepts console.* calls wholesale. Secrets, tokens, PII, or debug payloads logged by third-party SDKs will be transmitted to the server and stored in replay events. Unlike DOM masking (configurable via maskLevel), there is no filtering or redaction option. Consider documenting this risk near the toggle, or providing a level option (e.g., warn/error only) to limit exposure.
Feature: Enabled console log recording and playback in session replays.
Settings: Added a "Record console logs" toggle in the Website Replay settings UI.
Tracker: Integrated @rrweb/rrweb-plugin-console-record to capture console logs during recording.
Player: Integrated @rrweb/rrweb-plugin-console-replay to display logs during playback.
Localization: Added translation strings for English (US and GB).