feat: Add Browserless rendering backend for image exports#60793
Merged
Conversation
Contributor
Prompt To Fix All With AIFix the following 2 code review issues. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 2
posthog/settings/exports.py:3-4
Inconsistent env var naming will confuse operators. Two of the four settings read from `HEATMAP_BROWSERLESS_*` env vars (which belong to the Heatmap feature), while the two timeout settings read from `BROWSERLESS_*` env vars. A deployer who reads `BROWSERLESS_SESSION_TIMEOUT_MS` and logically tries to set `BROWSERLESS_CDP_URL` will have no effect — the actual env var that matters is `HEATMAP_BROWSERLESS_URL`. If re-using the existing Heatmap instance is intentional, the variable names or comments should make that explicit; otherwise the env var names should match their Python setting names.
```suggestion
BROWSERLESS_CDP_URL: str = get_from_env("BROWSERLESS_CDP_URL", "")
BROWSERLESS_TOKEN: str = get_from_env("BROWSERLESS_TOKEN", "")
```
### Issue 2 of 2
posthog/tasks/exports/image_exporter.py:597
The page-load timeout re-raise drops the exception cause chain. The original `PlaywrightTimeoutError` has already been sent to Sentry via `capture_exception`, but Python's chained-exception context is lost, which makes it harder to trace the root error in local logs or wherever the re-raised exception is caught upstream. Adding `from e` preserves the chain at zero cost.
```suggestion
raise PlaywrightTimeoutError("Timeout while waiting for the page to load") from e
```
Reviews (1): Last reviewed commit: "Add Browserless rendering backend for im..." | Re-trigger Greptile |
fercgomes
approved these changes
May 31, 2026
Piccirello
approved these changes
May 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Move image export to Browserless behind a feature flag
Changes
Add a Playwright/browserless rendering backend for PNG image exports (insights, dashboards, replays, heatmaps) alongside the existing Selenium path.
How did you test this code?
Locally, new tests
👉 Stay up-to-date with PostHog coding conventions for a smoother review.
Automatic notifications
Docs update
🤖 Agent context