Repository navigation
fix(cli): the browser download unpacks on machines without an unzip command - #5433
Open
miguel-heygen wants to merge 3 commits into
Open
miguel-heygen wants to merge 3 commits into
miguel-heygen wants to merge 3 commits into
Conversation
Contributor
Edit accuracy: accurate 2061 (base branch 2061), smooth 1546 of thoseThe gate passes. Quarantined, measured but not gated (0) |
This branch has not been deployed
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.
What changes for the user
On a Linux machine without the
unzipcommand (a fresh WSL Ubuntu, slim containers),hyperframes checkandrenderno longer fail withFailed to download chrome-headless-shell: Extraction failed: no zip archiver is available. The managed browser download now unpacks without any system tool.Root cause
The CLI downloads chrome-headless-shell through
@puppeteer/browsers. On Linux and macOS it unzips by running the systemunzip. When that is missing, its only fallback is theyauzlpackage, which@puppeteer/browsersdeclares as an optional peer dependency. The CLI never installed it, so with nounzipboth paths failed and the download stopped.Fix
yauzlis now a dependency of the CLI, so@puppeteer/browsersfinds its fallback unzipper. No CLI code changes: the library already triesunzipfirst andyauzlsecond.yauzlis not bundled into the CLI tarball (it is only loaded by@puppeteer/browsersat runtime), so the CLI's package size budget does not change.Also
yauzlis listed in the FallowignoreDependencies, next todebug: no CLI code imports it;@puppeteer/browsersloads it at runtime.Verification
unzipFallback.test.tsruns the real@puppeteer/browsersinstall()against a local server serving a chrome-headless-shell-shaped zip, withPATHpointing at an empty directory so nounzipis found. It checks the browser executable is unpacked. Skipped on Windows, where the library unzips withtar.exeby absolute path.yauzl, the test fails with the reported error (Extraction failed: no zip archiver is available); with it, it passes on Linux.Known limits
yauzlpath a corrupt download is not re-downloaded automatically:@puppeteer/browsersreportsExtraction failed: <archive path>and drops the zip error when it combines provider failures, so the CLI cannot tell a corrupt archive from other unzip failures. Re-running the command downloads again. Upstream note: in@puppeteer/browsers3.2.x,install()builds itsAll providers failederror from each provider error'smessageonly; keeping each error as the combined error'scausewould let callers detect a corrupt archive on this path.puppeteer's browser downloader, which still has noyauzloutside this repo. The publishedhyperframesCLI is covered.Why this PR is small
It is a one-dependency fix with its regression tests; the lockfile change adds only
yauzlandpend.