[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
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

Local test run fails with UnhandledPromiseRejectionWarning error message #20

Open
d2s opened this issue Jul 12, 2020 · 6 comments
Open
Labels
bug Something isn't working

Comments

@d2s
Copy link
d2s commented Jul 12, 2020

Couldn't run tests locally on a Linux virtual machine.

❯ npm run test-pages

> speedlify@1.0.0 test-pages /home/d2s/[... directory path ...]/speedlify
> node run-tests

There are no known last run timestamps
First tests for netlify.
Testing 9 sites:
(node:12367) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED 127.0.0.1:40217
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16)
(node:12367) 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:12367) [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.

Dependencies installed properly with npm install but for some reason Chromium doesn't seem to work properly.

❯ node --version
v12.18.0

This bug report is related to the latest Git commit cd322fe5f111ca59894b0c9f9497c57725fee087 of the speedlify repository.

@budparr
Copy link
budparr commented Jul 17, 2020

I was getting this error on MacOS. I think the culprit is puppeteer, as here: #17 (comment)

Removing puppeteer and re-installing node modules seems to have fixed it for me.

@brycewray
Copy link
brycewray commented Jul 20, 2020

In macOS, I am getting the same error after cloning the most recent speedlify repo (renaming the local folder speedlify-hosts-test) although a clone from two days ago worked fine. Maybe something broke in the interim? As the README suggests, I had replaced the /_data/_sites/*.js files with a /_data/sites.js of my own but had observed similar problems even when I left @zachleat's originals in place, too. This is what I get when I try npm run test-pages (and, yes, I did do npm install):

There are no known last run timestamps
(node:37780) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'length' of undefined
    at [... directory path ...]/speedlify-hosts-test/run-tests.js:70:73
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:37780) 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:37780) [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.

I should also note that I've been unable to get the latest speedlify to work on an install on either Netlify or render.com, running into roughly this same problem in each case.

@zachleat
Copy link
Owner

@brycewray can you file a separate issue? What’s your vertical config file look like? Sounds like you’re missing a urls array in the file.

@brycewray
Copy link
brycewray commented Jul 25, 2020

@brycewray can you file a separate issue? What’s your vertical config file look like? Sounds like you’re missing a urls array in the file.

Will file separate issue. Thanks.

Update: @zachleat, went back to your original config and saw the problem. PEBKAC on my part. 🤷 🤦 Thank you as always, sir.

@pbowyer
Copy link
pbowyer commented Aug 26, 2020

I have the same problem as @d2s. On a new Ubuntu 18.04 server, I run the following and get:

$ node -v
v14.8.0
$ git reflog HEAD
e9e4e58 (HEAD -> live, origin/live, origin/HEAD) HEAD@{0}: clone: from https://github.com/zachleat/speedlify.git
$ npm install
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.

> puppeteer@5.2.1 install /home/speedlify/speedlify/node_modules/puppeteer
> node install.js

Downloading Chromium r782078 - 126.4 Mb [====================] 100% 0.0s
Chromium (782078) downloaded to /home/speedlify/speedlify/node_modules/puppeteer/.local-chromium/linux-782078

> core-js@2.6.11 postinstall /home/speedlify/speedlify/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)


> ejs@2.7.4 postinstall /home/speedlify/speedlify/node_modules/ejs
> node ./postinstall.js

Thank you for installing EJS: built with the Jake JavaScript build tool (https://jakejs.com/)

npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN axe-puppeteer@1.1.0 requires a peer of puppeteer@^1.10.0 || ^2.0.0 but none is installed. You must install peer dependencies yourself.

added 676 packages from 581 contributors and audited 682 packages in 29.101s

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

found 0 vulnerabilities

$ npm run test-pages

> speedlify@1.0.0 test-pages /home/speedlify/speedlify
> node run-tests

There are no known last run timestamps
First tests for clients.
Testing 1 site:
(node:1061) UnhandledPromiseRejectionWarning: Error: connect ECONNREFUSED 127.0.0.1:38417
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1144:16)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:1061) 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:1061) [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.

I've tried it with different URLs to check if that's the problem. The sole file in _data/sites is data/sites/clients.js:

module.exports = {
        name: "clients", // optional, falls back to object key
        description: "Client sites",
        options: {
                frequency: 60 * 23, // 24 hours
                // Use "run" if the sites don’t share assets on the same origin
                //           and we can reset chrome with each run instead of
                //           each site in every run (it’s faster)
                // Use "site" if sites are all on the same origin and share assets.
                freshChrome: "run"
        },
        urls: [
             "https://www.google.com/",
        ]
};

wget works to fetch the URLs, so there isn't a firewall issue.

I don't know how to debug this. I added --verbose to npm run test-pages but that didn't help

@pbowyer
Copy link
pbowyer commented Aug 27, 2020

Solved for Ubuntu 18.04 by installing the following:

apt-get install -y libgtk2.0-0 libgtk-3-0 libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb libgbm-dev

How I got to this

joelgriffith/navalia#20 (comment) taught me about DEBUG=* which sadly didn't have much effect when running npm run test-pages.

After thinking about what software was used, I tried running lighthouse directly using

CHROME_PATH=/home/speedlify/speedlify/node_modules/puppeteer/.local-chromium/linux-782078/chrome-linux/chrome node ./node_modules/lighthouse/lighthouse-cli https://google.com  --chrome-flags="--no-sandbox --headless --disable-gpu"

This output an error that a .so was missing. I installed that, re-ran and another .so was listed.

Rather than installing them one-by-one I went looking for a list of extra packages. After a bit of trial and error (there's lots of "You need this to get Puppeteer to run" posts, many outdated - one of which I'd tried installing straight after my first comment, and it didn't work) I found the list above at puppeteer/puppeteer#3443 (comment).

@zachleat zachleat added the bug Something isn't working label Sep 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants