Skip to content

Update compile script to support new headless chromium config #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ash-plunkett-alliance
Copy link

@ash-plunkett-alliance ash-plunkett-alliance commented Mar 4, 2025

Playwright 1.49.0+ has rolled in Chrome 112's changes to their headless browser.

Chrome blog: https://developer.chrome.com/blog/chrome-headless-shell

Related playwright issue/explainer: microsoft/playwright#33566

What this actually means is that playwright install chromium installs both full Chromium, as well as Chromium Headless Shell.

At the time of writing, that comes out to ~199mb. I only first noticed this after upgrading playwright because Heroku was rejecting the build for exceeding the 500mb slug limit.

After digging around, instead of playwright install chromium, we should now be using playwright install chromium-headless-shell (or playwright install chromium --only-shell, appears to be the same thing) if we don't want full Chromium. This'll install only the headless version, ~77mb at the time of writing.

Unfortunately it's not as simple as just doing that though. The executable for the headless Chromium isn't called just chrome, it's called headless_shell - which means that CHROMIUM_EXECUTABLE_PATH isn't automatically set by this buildpack anymore if you only need the headless version installed.

All this PR does is update the compile script; if chrome isn't found, then it looks for headless_shell - and if that's found, then it sets CHROMIUM_EXECUTABLE_PATH to that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant