PostHog / PostHog/posthog

Session recording do not work with hashed assets

Open
#17,865 2 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug feature/replay
Dominant language
Python
Stars
39.9k
Forks
3.4k
Avg merge
7h 27m
Merged PRs (30d)
222

Description

Bug description

According to docs, most of the time the session recording feature will fetch assets (fonts, js, images, css, etc.) inline - when the recording is captured.

But for some assets, it will only access the resource in "real-time" - when rendering a recording.

If a "hashed asset" (e.g. https://example.com/assets/vendor-cd39faaa.js) has been rebuilt in the timeframe between the recording capture to its rendering, the asset won't load when rendering the recording.

How to reproduce

  1. Create an empty vite app (or any other bundler that uses hashed assets).
  2. Install the react posthog snippet in the app.
  3. Deploy the app on Netlify (for example, any other service that uses atomic deploys will do).
  4. Record a session.
  5. Rebuild and re-deploy the app, the URLs of the hashed assets are now changed.
  6. Replay the session from step 4, you'll notice that some requests (e.g., vendor-XXXXXXXX.js will point to 404 URLs.

Environment

  • PostHog Cloud US, project ID: 34026
  • PostHog Cloud EU, project ID: None
  • PostHog Hobby self-hosted with docker compose, version/commit: None
  • PostHog self-hosted with Kubernetes (deprecated, see "Sunsetting Kubernetes support"), version/commit: None

Additional context

This can be solved by downloading the non-inline assets in the background like fullstory does in a short timeframe after the capture.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with an empty Vite app using the React PostHog snippet, then capture and replay a session across two atomic deployments. Trace the session recording asset loading behavior described in the report; done means hashed assets from the original recording no longer produce 404 requests during replay.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react, vite
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.