Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(replay): skip plugin snapshots without data in network inspector (#116295)

posthog[bot]bf0443287864
diff --git a/frontend/src/scenes/session-recordings/apm/performance-event-utils.test.ts b/frontend/src/scenes/session-recordings/apm/performance-event-utils.test.ts
index 53129e167bbc..bc05b1230a0b 100644
--- a/frontend/src/scenes/session-recordings/apm/performance-event-utils.test.ts
+++ b/frontend/src/scenes/session-recordings/apm/performance-event-utils.test.ts
@@ -289,6 +289,8 @@ describe('performance-event-utils', () => {
['rrweb/network@1 with null payload', { plugin: 'rrweb/network@1', payload: null }],
['posthog/network@1 with missing payload', { plugin: 'posthog/network@1' }],
['posthog/network@1 with null payload', { plugin: 'posthog/network@1', payload: null }],
+ ['plugin snapshot with missing data', undefined],
+ ['plugin snapshot with null data', null],
])('does not crash when network snapshot has no usable payload (%s)', (_name, snapshotData) => {
const snapshot = {
windowId: '018d5247-079c-7126-8e43-464605576a62',
diff --git a/frontend/src/scenes/session-recordings/apm/performance-event-utils.ts b/frontend/src/scenes/session-recordings/apm/performance-event-utils.ts
index 92e3d58f7585..4e7b5ccf28d0 100644
--- a/frontend/src/scenes/session-recordings/apm/performance-event-utils.ts
+++ b/frontend/src/scenes/session-recordings/apm/performance-event-utils.ts
@@ -236,7 +236,7 @@ export function getPerformanceEvents(snapshotsByWindowId: Record<string, eventWi
snapshots.forEach((snapshot: eventWithTime) => {
if (
snapshot.type === 6 && // RRWeb plugin event type
- snapshot.data.plugin === NETWORK_PLUGIN_NAME
+ snapshot.data?.plugin === NETWORK_PLUGIN_NAME
) {
const properties = snapshot.data.payload as any
if (!properties || typeof properties !== 'object') {
@@ -260,7 +260,7 @@ export function getPerformanceEvents(snapshotsByWindowId: Record<string, eventWi
if (
snapshot.type === 6 && // RRWeb plugin event type
- snapshot.data.plugin === RRWEB_NETWORK_PLUGIN_NAME
+ snapshot.data?.plugin === RRWEB_NETWORK_PLUGIN_NAME
) {
const payload = snapshot.data.payload as any