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

Run cli command with --samples 3 will trigger error #60

Closed
nogamenofun98 opened this issue May 9, 2023 · 13 comments
Closed

Run cli command with --samples 3 will trigger error #60

nogamenofun98 opened this issue May 9, 2023 · 13 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@nogamenofun98
Copy link

Describe the bug

After running a while, the cli response the following:

Error: Cannot create new tab, and no tabs already open.
at C:\Users\ant008\AppData\Local\npm-cache_npx\9c5b11f5f0ea845b\node_modules\lighthouse\lighthouse-core\gather\connections\cri.js:45:35
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Driver.connect (C:\Users\ant008\AppData\Local\npm-cache_npx\9c5b11f5f0ea845b\node_modules\lighthouse\lighthouse-core\gather\driver.js:119:5)
at async Function.run (C:\Users\ant008\AppData\Local\npm-cache_npx\9c5b11f5f0ea845b\node_modules\lighthouse\lighthouse-core\gather\gather-runner.js:484:7)
at async Function._gatherArtifactsFromBrowser (C:\Users\ant008\AppData\Local\npm-cache_npx\9c5b11f5f0ea845b\node_modules\lighthouse\lighthouse-core\runner.js:264:23)
at async Function.gather (C:\Users\ant008\AppData\Local\npm-cache_npx\9c5b11f5f0ea845b\node_modules\lighthouse\lighthouse-core\runner.js:170:21)
at async lighthouse (C:\Users\ant008\AppData\Local\npm-cache_npx\9c5b11f5f0ea845b\node_modules\lighthouse\lighthouse-core\index.js:50:21)
at async file:https:///C:/Users/ant008/AppData/Local/npm-cache/_npx/9c5b11f5f0ea845b/node_modules/@unlighthouse/core/dist/process/lighthouse.mjs:16:26
Error: Cannot create new tab, and no tabs already open.
at C:\Users\ant008\AppData\Local\npm-cache_npx\9c5b11f5f0ea845b\node_modules\lighthouse\lighthouse-core\gather\connections\cri.js:45:35
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Driver.connect (C:\Users\ant008\AppData\Local\npm-cache_npx\9c5b11f5f0ea845b\node_modules\lighthouse\lighthouse-core\gather\driver.js:119:5)
at async Function.run (C:\Users\ant008\AppData\Local\npm-cache_npx\9c5b11f5f0ea845b\node_modules\lighthouse\lighthouse-core\gather\gather-runner.js:484:7)
at async Function._gatherArtifactsFromBrowser (C:\Users\ant008\AppData\Local\npm-cache_npx\9c5b11f5f0ea845b\node_modules\lighthouse\lighthouse-core\runner.js:264:23)
at async Function.gather (C:\Users\ant008\AppData\Local\npm-cache_npx\9c5b11f5f0ea845b\node_modules\lighthouse\lighthouse-core\runner.js:170:21)
at async lighthouse (C:\Users\ant008\AppData\Local\npm-cache_npx\9c5b11f5f0ea845b\node_modules\lighthouse\lighthouse-core\index.js:50:21)
at async file:https:///C:/Users/ant008/AppData/Local/npm-cache/_npx/9c5b11f5f0ea845b/node_modules/@unlighthouse/core/dist/process/lighthouse.mjs:16:26
C:\Users\ant008\AppData\Local\npm-cache_npx\9c5b11f5f0ea845b\node_modules\lighthouse\lighthouse-core\gather\driver.js:348
asyncTimeout = setTimeout(reject, timeout, new LHError(LHError.errors.PROTOCOL_TIMEOUT, {
^

LighthouseError [LHError]: PROTOCOL_TIMEOUT
at C:\Users\ant008\AppData\Local\npm-cache_npx\9c5b11f5f0ea845b\node_modules\lighthouse\lighthouse-core\gather\driver.js:348:50
at new Promise ()
at Driver.sendCommandToSession (C:\Users\ant008\AppData\Local\npm-cache_npx\9c5b11f5f0ea845b\node_modules\lighthouse\lighthouse-core\gather\driver.js:346:28)
at Driver.sendCommand (C:\Users\ant008\AppData\Local\npm-cache_npx\9c5b11f5f0ea845b\node_modules\lighthouse\lighthouse-core\gather\driver.js:369:17)
at Object.clearDataForOrigin (C:\Users\ant008\AppData\Local\npm-cache_npx\9c5b11f5f0ea845b\node_modules\lighthouse\lighthouse-core\gather\driver\storage.js:58:19)
at Function.disposeDriver (C:\Users\ant008\AppData\Local\npm-cache_npx\9c5b11f5f0ea845b\node_modules\lighthouse\lighthouse-core\gather\gather-runner.js:179:39)
at Function.run (C:\Users\ant008\AppData\Local\npm-cache_npx\9c5b11f5f0ea845b\node_modules\lighthouse\lighthouse-core\gather\gather-runner.js:532:20)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Function._gatherArtifactsFromBrowser (C:\Users\ant008\AppData\Local\npm-cache_npx\9c5b11f5f0ea845b\node_modules\lighthouse\lighthouse-core\runner.js:264:23)
at async Function.gather (C:\Users\ant008\AppData\Local\npm-cache_npx\9c5b11f5f0ea845b\node_modules\lighthouse\lighthouse-core\runner.js:170:21) {
code: 'PROTOCOL_TIMEOUT',
friendlyMessage: {
i18nId: 'lighthouse-core/lib/lh-error.js | protocolTimeout',
values: {
errorCode: 'PROTOCOL_TIMEOUT',
protocolMethod: 'Storage.clearDataForOrigin'
},
formattedDefault: 'Waiting for DevTools protocol response has exceeded the allotted time. (Method: Storage.clearDataForOrigin)'
},
lhrRuntimeError: true,
protocolMethod: 'Storage.clearDataForOrigin'
}

Node.js v17.1.0

ERROR Failed to run lighthouse for route Command failed with exit code 1: node C:/Users/ant008/AppData/Local/npm-cache/_npx/9c5b11f5f0ea845b/node_modules/@unlighthouse/core/dist/process/lighthouse.mjs --cache=true --routeReport={"route":{"url":"https://next.syopex.com/brand/skll"},"artifactPath":"D:\\Frontend\\unlighthouse\\.unlighthouse\\next.syopex.com\\e6ae\\reports\\brand\\skll"} --lighthouseOptions={"onlyCategories":["performance","accessibility","best-practices","seo"],"throttlingMethod":"provided","throttling":{"rttMs":0,"throughputKbps":0,"cpuSlowdownMultiplier":1,"requestLatencyMs":0,"downloadThroughputKbps":0,"uploadThroughputKbps":0},"formFactor":"mobile","screenEmulation":{"mobile":true,"width":360,"height":640,"deviceScaleFactor":2}} --port=54889
Error: Cannot create new tab, and no tabs already open.
at C:\Users\ant008\AppData\Local\npm-cache_npx\9c5b11f5f0ea845b\node_modules\lighthouse\lighthouse-core\gather\connections\cri.js:45:35
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Driver.connect (C:\Users\ant008\AppData\Local\npm-cache_npx\9c5b11f5f0ea845b\node_modules\lighthouse\lighthouse-core\gather\driver.js:119:5)
at async Function.run (C:\Users\ant008\AppData\Local\npm-cache_npx\9c5b11f5f0ea845b\node_modules\lighthouse\lighthouse-core\gather\gather-runner.js:484:7)
at async Function._gatherArtifactsFromBrowser (C:\Users\ant008\AppData\Local\npm-cache_npx\9c5b11f5f0ea845b\node_modules\lighthouse\lighthouse-core\runner.js:264:23)
at async Function.gather (C:\Users\ant008\AppData\Local\npm-cache_npx\9c5b11f5f0ea845b\node_modules\lighthouse\lighthouse-core\runner.js:170:21)
at async lighthouse (C:\Users\ant008\AppData\Local\npm-cache_npx\9c5b11f5f0ea845b\node_modules\lighthouse\lighthouse-core\index.js:50:21)
at async file:https:///C:/Users/ant008/AppData/Local/npm-cache/_npx/9c5b11f5f0ea845b/node_modules/@unlighthouse/core/dist/process/lighthouse.mjs:16:26
C:\Users\ant008\AppData\Local\npm-cache_npx\9c5b11f5f0ea845b\node_modules\lighthouse\lighthouse-core\gather\driver.js:348
asyncTimeout = setTimeout(reject, timeout, new LHError(LHError.errors.PROTOCOL_TIMEOUT, {

Reproduction

npx unlighthouse-puppeteer --site next.syopex.com --samples 3 OR npx unlighthouse --site next.syopex.com --samples 3

System / Nuxt Info

System:
    OS: Windows 10 10.0.19045
    CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
    Memory: 7.24 GB / 15.92 GB
  Binaries:
    Node: 17.1.0 - C:\Program Files\nodejs\node.EXE
    npm: 8.1.2 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromium (113.0.1774.35)
    Internet Explorer: 11.0.19041.1566
@nogamenofun98 nogamenofun98 changed the title Run cli command with --samples 3 will trigger error Run cli command with --samples 3 will trigger error May 9, 2023
@harlan-zw harlan-zw added the bug Something isn't working label May 10, 2023
@briantully
Copy link

briantully commented May 13, 2023

Same here using the unlighthouse command with an unlighthouse.config.ts file with scanner.samples 3 set.

Reproduction
unlighthouse

System / Nuxt Info

System:
    OS: macOS 12.6.5 
    CPU: Apple M1 Max
    Memory: 32 GB
  Binaries:
    Node: 16.20.0
    npm: 9.6.6
  Browsers:
    Chrome Version 113.0.5672.92 (Official Build) (arm64)

@harlan-zw
Copy link
Owner

harlan-zw commented May 14, 2023

Hi, thanks for the issue :)

I am not able to replicate it personally, though this may be resolved with Unlighthouse 0.7.0 with the updated Puppeteer dependency. If it still doesn't work you can try to pass the config: chrome.useSystem: false and use the fallback Chrome installer.

@briantully
Copy link

thanks @harlan-zw I tried again with 0.7.1, and with using chrome.useSystem: false, but this time got a different error:

› GET /api/scan-meta 200 object - 1ms                                                                                unlighthouse-api 14:31:45
/Users/brian.tully/.nvm/versions/node/v16.20.0/lib/node_modules/unlighthouse/node_modules/puppeteer-core/lib/cjs/puppeteer/util/assert.js:28
        throw new Error(message);
              ^

Error: Cannot extract value when objectId is given
    at assert (/Users/brian.tully/.nvm/versions/node/v16.20.0/lib/node_modules/unlighthouse/node_modules/puppeteer-core/lib/cjs/puppeteer/util/assert.js:28:15)
    at valueFromRemoteObject (/Users/brian.tully/.nvm/versions/node/v16.20.0/lib/node_modules/unlighthouse/node_modules/puppeteer-core/lib/cjs/puppeteer/common/util.js:239:28)
    at createClientError (/Users/brian.tully/.nvm/versions/node/v16.20.0/lib/node_modules/unlighthouse/node_modules/puppeteer-core/lib/cjs/puppeteer/common/util.js:122:16)
    at CDPPage._CDPPage_handleException (/Users/brian.tully/.nvm/versions/node/v16.20.0/lib/node_modules/unlighthouse/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Page.js:894:94)
    at /Users/brian.tully/.nvm/versions/node/v16.20.0/lib/node_modules/unlighthouse/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Page.js:186:100
    at /Users/brian.tully/.nvm/versions/node/v16.20.0/lib/node_modules/unlighthouse/node_modules/puppeteer-core/lib/cjs/third_party/mitt/index.js:3:248
    at Array.map (<anonymous>)
    at Object.emit (/Users/brian.tully/.nvm/versions/node/v16.20.0/lib/node_modules/unlighthouse/node_modules/puppeteer-core/lib/cjs/third_party/mitt/index.js:3:232)
    at CDPSessionImpl.emit (/Users/brian.tully/.nvm/versions/node/v16.20.0/lib/node_modules/unlighthouse/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EventEmitter.js:87:22)
    at CDPSessionImpl._onMessage (/Users/brian.tully/.nvm/versions/node/v16.20.0/lib/node_modules/unlighthouse/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:441:18)
    at Connection.onMessage (/Users/brian.tully/.nvm/versions/node/v16.20.0/lib/node_modules/unlighthouse/node_modules/puppeteer-core/lib/cjs/puppeteer/common/Connection.js:269:25)
    at WebSocket.<anonymous> (/Users/brian.tully/.nvm/versions/node/v16.20.0/lib/node_modules/unlighthouse/node_modules/puppeteer-core/lib/cjs/puppeteer/common/NodeWebSocketTransport.js:62:32)
    at callListener (/Users/brian.tully/.nvm/versions/node/v16.20.0/lib/node_modules/unlighthouse/node_modules/ws/lib/event-target.js:290:14)
    at WebSocket.onMessage (/Users/brian.tully/.nvm/versions/node/v16.20.0/lib/node_modules/unlighthouse/node_modules/ws/lib/event-target.js:209:9)
    at WebSocket.emit (node:events:513:28)
    at Receiver.receiverOnMessage (/Users/brian.tully/.nvm/versions/node/v16.20.0/lib/node_modules/unlighthouse/node_modules/ws/lib/websocket.js:1184:20)
    at Receiver.emit (node:events:513:28)
    at Receiver.dataMessage (/Users/brian.tully/.nvm/versions/node/v16.20.0/lib/node_modules/unlighthouse/node_modules/ws/lib/receiver.js:541:14)
    at Receiver.getData (/Users/brian.tully/.nvm/versions/node/v16.20.0/lib/node_modules/unlighthouse/node_modules/ws/lib/receiver.js:459:17)
    at Receiver.startLoop (/Users/brian.tully/.nvm/versions/node/v16.20.0/lib/node_modules/unlighthouse/node_modules/ws/lib/receiver.js:158:22)
    at Receiver._write (/Users/brian.tully/.nvm/versions/node/v16.20.0/lib/node_modules/unlighthouse/node_modules/ws/lib/receiver.js:84:10)
    at writeOrBuffer (node:internal/streams/writable:391:12)
    at _write (node:internal/streams/writable:332:10)
    at Receiver.Writable.write (node:internal/streams/writable:336:10)
    at Socket.socketOnData (/Users/brian.tully/.nvm/versions/node/v16.20.0/lib/node_modules/unlighthouse/node_modules/ws/lib/websocket.js:1278:35)
    at Socket.emit (node:events:513:28)
    at addChunk (node:internal/streams/readable:315:12)
    at readableAddChunk (node:internal/streams/readable:289:9)
    at Socket.Readable.push (node:internal/streams/readable:228:10)

@nogamenofun98
Copy link
Author

nogamenofun98 commented May 16, 2023

Hi, thanks for the issue :)

I am not able to replicate it personally, though this may be resolved with Unlighthouse 0.7.0 with the updated Puppeteer dependency. If it still doesn't work you can try to pass the config: chrome.useSystem: false and use the fallback Chrome installer.

I tried to put chrome.useSystem:false in the unlighthouse config file, it did download a fallback chrome automatically but still response the same error. I also tried to manually point it to my local chrome installation (both chrome and edge tested), and it also response same error.

Unlighthouse version: unlighthouse/0.7.4 win32-x64 node-v16.20.0

Here is my config:

export default {
  puppeteerClusterOptions: {
      // only run 1 worker at a time 
    maxConcurrency: 1
  },
  puppeteerOptions: {
    executablePath: 'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe'
  }
}

@harlan-zw harlan-zw added the help wanted Extra attention is needed label May 18, 2023
@harlan-zw
Copy link
Owner

Sorry I'd like to help further but I can't replicate on my Linux laptop, if any Windows users have capacity to help me debug it would be appreicated.

@NathanBeddoeWebDev
Copy link

NathanBeddoeWebDev commented May 23, 2023

I saw this issue when I tried using samples 3 as well, I'll see if I can debug it and figure out what the issue is.

From what I've read, it's a Lighthouse 9 issue, that's resolved in 10. I'm not sure @harlan-zw what your plans are for keeping up to date with lighthouse versions.

@harlan-zw
Copy link
Owner

I have made two attempts to upgrade so far, it hasn't been very successful as there's many breaking changes (cjs support is dropped). Will attempt again soon .

@rachelmflowers
Copy link

rachelmflowers commented Jun 9, 2023

This has also been happening to me since February. It seemed to me to happen after my chrome upgraded to version 110 +.

I updated my local versions of Node, NPM, unlighthouse, but still getting the same errors.

I also tried to set the downloadFallbackVersion to 1069704 (chromium 109 release using this list as a reference: ) but it always downloaded the default fallback version and I couldnt get it to download the version I wanted it to.

I get this error if my sampling rate is anything more than 1.

Error: Cannot create new tab, and no tabs already open.
    at /Users/rachels/.npm/_npx/944abecbf21dfffb/node_modules/lighthouse/lighthouse-core/gather/connections/cri.js:45:35
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Driver.connect (/Users/rachels/.npm/_npx/944abecbf21dfffb/node_modules/lighthouse/lighthouse-core/gather/driver.js:119:5)
    at async GatherRunner.run (/Users/rachels/.npm/_npx/944abecbf21dfffb/node_modules/lighthouse/lighthouse-core/gather/gather-runner.js:484:7)
    at async Runner._gatherArtifactsFromBrowser (/Users/rachels/.npm/_npx/944abecbf21dfffb/node_modules/lighthouse/lighthouse-core/runner.js:264:23)
    at async Runner.gather (/Users/rachels/.npm/_npx/944abecbf21dfffb/node_modules/lighthouse/lighthouse-core/runner.js:170:21)
    at async lighthouse (/Users/rachels/.npm/_npx/944abecbf21dfffb/node_modules/lighthouse/lighthouse-core/index.js:50:21)
    at async file:https:///Users/rachels/.npm/_npx/944abecbf21dfffb/node_modules/@unlighthouse/core/dist/process/lighthouse.mjs:16:26
/Users/rachels/.npm/_npx/944abecbf21dfffb/node_modules/lighthouse/lighthouse-core/gather/driver.js:348
      asyncTimeout = setTimeout(reject, timeout, new LHError(LHError.errors.PROTOCOL_TIMEOUT, {
                                                 ^

LighthouseError [LHError]: PROTOCOL_TIMEOUT
    at /Users/rachels/.npm/_npx/944abecbf21dfffb/node_modules/lighthouse/lighthouse-core/gather/driver.js:348:50
    at new Promise (<anonymous>)
    at Driver.sendCommandToSession (/Users/rachels/.npm/_npx/944abecbf21dfffb/node_modules/lighthouse/lighthouse-core/gather/driver.js:346:28)
    at Driver.sendCommand (/Users/rachels/.npm/_npx/944abecbf21dfffb/node_modules/lighthouse/lighthouse-core/gather/driver.js:369:17)
    at Object.clearDataForOrigin (/Users/rachels/.npm/_npx/944abecbf21dfffb/node_modules/lighthouse/lighthouse-core/gather/driver/storage.js:58:19)
    at GatherRunner.disposeDriver (/Users/rachels/.npm/_npx/944abecbf21dfffb/node_modules/lighthouse/lighthouse-core/gather/gather-runner.js:179:39)
    at GatherRunner.run (/Users/rachels/.npm/_npx/944abecbf21dfffb/node_modules/lighthouse/lighthouse-core/gather/gather-runner.js:532:20)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Runner._gatherArtifactsFromBrowser (/Users/rachels/.npm/_npx/944abecbf21dfffb/node_modules/lighthouse/lighthouse-core/runner.js:264:23)
    at async Runner.gather (/Users/rachels/.npm/_npx/944abecbf21dfffb/node_modules/lighthouse/lighthouse-core/runner.js:170:21) {
  code: 'PROTOCOL_TIMEOUT',
  friendlyMessage: {
    i18nId: 'lighthouse-core/lib/lh-error.js | protocolTimeout',
    values: {
      errorCode: 'PROTOCOL_TIMEOUT',
      protocolMethod: 'Storage.clearDataForOrigin'
    },
    formattedDefault: 'Waiting for DevTools protocol response has exceeded the allotted time. (Method: Storage.clearDataForOrigin)'
  },
  lhrRuntimeError: true,
  protocolMethod: 'Storage.clearDataForOrigin'
}

Node.js v18.16.0

[unlighthouse 11:27:18 AM]  ERROR  Failed to run lighthouse for route Command failed with exit code 1: node /Users/rachels/.npm/_npx/944abecbf21dfffb/node_modules/@unlighthouse/core/dist/process/lighthouse.mjs --cache=true --routeReport={"route":{"url":"https://www.virtus.com/account/edit"},"artifactPath":"/Users/rachels/Development/performance configs/Virtus Mainsite/virtus.com/.unlighthouse/www.virtus.com/fabe/reports/account/edit"} --lighthouseOptions={"onlyCategories":["performance","best-practices"],"throttlingMethod":"provided","throttling":{"rttMs":0,"throughputKbps":0,"cpuSlowdownMultiplier":1,"requestLatencyMs":0,"downloadThroughputKbps":0,"uploadThroughputKbps":0},"formFactor":"desktop","screenEmulation":{"mobile":false,"width":1350,"height":940,"deviceScaleFactor":1,"disabled":false},"emulatedUserAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36"} --port=52642

@broskees
Copy link

Just ran into this issue myself. Seems related to this.

@OliCote
Copy link

OliCote commented Jul 26, 2023

Just to give more information about the problem, it also occurs for me on MacOS when sample is past 2. I don't have the time to take a look to fix it, sorry. I love the library tho.

System:
    OS: MacOs Monterey 12.1
  Binaries:
    Node: 18.17.0
    npm: 9.4.1
  Browsers:
    Chrome(Version 114.0.5735.248)

@mwskwong
Copy link

mwskwong commented Feb 17, 2024

I have made two attempts to upgrade so far, it hasn't been very successful as there's many breaking changes (cjs support is dropped). Will attempt again soon .

I'm really looking forward to this. This is especially important in CI environment since the CPU/Memory power varies in quite a lot when running against multiple pages. Without samples, it is really hard to set a meaningful budget to warn about performance issue.

@842u
Copy link

842u commented Feb 19, 2024

The problem can be resolved by bumping the version of the Lighthouse package inside @unlighthouse/core.

#183 made that changes to the codebase. However, the current version (v0.10.6) still uses Lighthouse (^9.6.8) so we may need to wait for the new version release.

For those interested, here's a GitHub workflow file where the Lighthouse version is manually updated.

@mwskwong
Copy link

The problem can be resolved by bumping the version of the Lighthouse package inside @unlighthouse/core.

#183 made that changes to the codebase. However, the current version (v0.10.6) still uses Lighthouse (^9.6.8) so we may need to wait for the new version release.

For those interested, here's a GitHub workflow file where the Lighthouse version is manually updated.

Just tried this. Though --samples can be used now, I noticed that Lighthouse crashes fairly frequently. Not sure whether this is related to the compatibility with the current @unlighthouse/core implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

9 participants