Graylog2 / Graylog2/graylog2-server

PostHog session recording does not start after telemetry opt-in

Open
#26,670 1 comment 0 reactions 1 assignee Claimed by @aaronmgn View on GitHub
bug triaged
Dominant language
Java
Stars
8.1k
Forks
1.1k
Avg merge
1d 20h
Merged PRs (30d)
217

Description

## Expected Behavior

When telemetry is enabled for a user and session recording is enabled in the PostHog project, the frontend should load a recorder compatible with the installed `posthog-js` SDK, start recording, and upload `$snapshot` events.
## Current Behavior

PostHog analytics initializes after the user accepts telemetry, but session recording does not start and no replay is created.

The browser loads the recorder using a legacy query-string URL:
`/static/posthog-recorder.js?v=1.262.0`

Recorder initialization then fails with the following browser console error:
`TypeError: this.ys.onRemoteConfig is not a function`

`ys` is the lazy-loaded session recorder instance. The main PostHog SDK calls `onRemoteConfig()` on this instance before calling `start()`. Because the loaded recorder does not provide the expected method, initialization terminates before recording starts.

This indicates that the bundled PostHog SDK and the remotely loaded recorder script are incompatible.

The frontend also does not use the latest available `posthog-js` release:

- Declared dependency: `^1.371.1`
- Locked dependency: `1.372.8`
- Version observed in the affected deployment: `1.262.0`
- Latest available version at the time of investigation: `1.400.1`

## Possible Solution

TBD
## Steps to Reproduce (for bugs)

1. Configure Graylog telemetry with a PostHog project that has session recording enabled.
2. Sign in with a user who has not yet answered the telemetry prompt.
3. Accept the telemetry prompt.
4. Navigate through and interact with the Graylog frontend.
5. Open the browser developer console and inspect the loaded PostHog scripts.
6. Observe that `posthog-recorder.js?v=1.262.0` is loaded.
7. Observe `TypeError: this.ys.onRemoteConfig is not a function`.
8. Confirm that no session replay appears in PostHog.

## Context

## Your Environment

* Graylog Version: Latest 7.2.0-Snapshot

## Checklist
[] This issue fix need to be backported.
[] Does this issue have **security** implications?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.