Skip to content
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

[BUG] Installation of playwright is successful even if fetching browser binaries fails #1731

Closed
lukaszfiszer opened this issue Apr 9, 2020 · 0 comments · Fixed by #1739
Closed

Comments

@lukaszfiszer
Copy link
Contributor

lukaszfiszer commented Apr 9, 2020

Context:

  • Playwright Version: 0.12.1
  • Operating System: Windows
  • Extra: node 12.16

Describe the bug

If fetching browser binaries fails during installation of playwright (for example because of network error) the whole installation is still successful. When using npm a warning is printed to the console. In yarn, which swallows console logs from postinstall scripts, there is no indication that something went wrong.

The root cause of the bug is that promise rejection in https://github.com/microsoft/playwright/blob/master/src/server/browserFetcher.ts#L147 is not handled in any way, for example with process.exit(1). Because in node<=12 unhandled promise rejections does not terminate the process, this causes whole installation script to succeed instead of failing it.

Code Snippet

npm

λ npm install playwright

> playwright@0.12.1 install C:\Users\hlukafis\projects\test\node_modules\playwright
> node install.js

(node:16680) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED 216.58.205.48:443
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1137:16)
(node:16680) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:16680) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

+ playwright@0.12.1
added 46 packages from 36 contributors in 17.19s

2 packages are looking for funding
  run `npm fund` for details

yarn

λ yarn add playwright
yarn add v1.21.1
info No lockfile found.
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 40 new dependencies.
info Direct dependencies
└─ playwright@0.12.1
info All dependencies
├─ agent-base@4.3.0
├─ async-limiter@1.0.1
├─ balanced-match@1.0.0
├─ brace-expansion@1.1.11
├─ buffer-crc32@0.2.13
├─ buffer-from@1.1.1
├─ concat-map@0.0.1
├─ concat-stream@1.6.2
├─ core-util-is@1.0.2
├─ debug@4.1.1
├─ es6-promise@4.2.8
├─ es6-promisify@5.0.0
├─ extract-zip@1.7.0
├─ fd-slicer@1.1.0
├─ fs.realpath@1.0.0
├─ glob@7.1.6
├─ https-proxy-agent@3.0.1
├─ inflight@1.0.6
├─ inherits@2.0.4
├─ isarray@1.0.0
├─ jpeg-js@0.3.7
├─ minimatch@3.0.4
├─ minimist@1.2.5
├─ mkdirp@0.5.5
├─ path-is-absolute@1.0.1
├─ pend@1.2.0
├─ playwright-core@0.12.1
├─ playwright@0.12.1
├─ pngjs@3.4.0
├─ process-nextick-args@2.0.1
├─ progress@2.0.3
├─ proxy-from-env@1.1.0
├─ readable-stream@2.3.7
├─ rimraf@3.0.2
├─ safe-buffer@5.1.2
├─ string_decoder@1.1.1
├─ typedarray@0.0.6
├─ util-deprecate@1.0.2
├─ ws@6.2.1
└─ yauzl@2.10.0
Done in 17.66s.

C:\Users\hlukafis\projects\test  (test@1.0.0)
λ ls node_modules\playwright
index.d.ts  index.js  install.js  package.json  README.md // binaries here
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 a pull request may close this issue.

1 participant