-
Notifications
You must be signed in to change notification settings - Fork 16.3k
fix(browse): honor GSTACK_CHROMIUM_PATH in headless launch()#1968
fix(browse): honor GSTACK_CHROMIUM_PATH in headless launch() #1968shofel wants to merge 1 commit into
Conversation
The headed launchPersistentContext() path already honors GSTACK_CHROMIUM_PATH, but the headless chromium.launch() path did not. On NixOS the bundled Playwright chrome-headless-shell is FHS-linked and can't load its shared libs, so headless rendering (make-pdf, screenshots, PDF export) fails with no way to override the binary. Mirror the headed path: pass executablePath when GSTACK_CHROMIUM_PATH is set.
Merging to main in this repository is managed by Trunk.
- To merge this pull request, check the box to the left or comment
/trunk mergebelow.
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here
jbetala7
commented
Jun 11, 2026
Reviewed this — looks correct, nice tight fix.
The headed launchPersistentContext() path already honors GSTACK_CHROMIUM_PATH via executablePath (browser-manager.ts ~L490–566), but the headless chromium.launch() at ~L372 didn't, so this 4-line env-gated change closes a real and consistent gap (the NixOS headless make-pdf failure). Default behavior is unchanged since executablePath is only spread in when the env var is set, and it mirrors the existing headed handling exactly. No change requested from me.
One coordination heads-up: #1933 (GSTACK_CHROMIUM_ARGS / GSTACK_HTTP_CREDENTIALS) and #1915 (GSTACK_HEADED_NOGPU) also edit this same launch path, so whichever lands first will leave the others with a trivial conflict — might be worth sequencing the three.
Problem
The headed
launchPersistentContext()path honorsGSTACK_CHROMIUM_PATH, but the headlesschromium.launch()path does not. There is no way to point headless rendering at a custom Chromium.On NixOS this breaks
make-pdf(and any headless screenshot/PDF flow): Playwright's bundledchrome-headless-shellis FHS-linked and can't load its shared libs, so the daemon fails to launch Chromium andmake-pdfproduces no output. SettingGSTACK_CHROMIUM_PATHto a system Chromium has no effect because the headless path ignores it.Fix
Mirror the headed path: pass
executablePathtochromium.launch()whenGSTACK_CHROMIUM_PATHis set. Four lines, gated on the env var so default behavior is unchanged.Verification
On NixOS with
GSTACK_CHROMIUM_PATHpointing at a Nix-builtungoogled-chromium,make-pdf generatenow renders a correct multi-element PDF (heading, bold, inline code, lists) — confirmed viapdftotextextraction and a rendered PNG. Without the patch the same setup fails at Chromium launch.Note (separate issue)
make-pdf'sbrowseClientbinary discovery (argv[0]-based) misresolves for the Bun-compiledpdfbinary and needsGSTACK_BROWSE_BINpinned to reliably use the right daemon. That's independent of this change and not addressed here.