harlan-zw / unlighthouse

Scan your entire site with Google Lighthouse in 2 minutes (on average). Open source, fully configurable with minimal setup.
https://unlighthouse.dev
MIT License
3.89k stars 115 forks source link

Broken JSON dump #255

Open wh1t3h47 opened 5 hours ago

wh1t3h47 commented 5 hours ago

Describe the bug

undefined got stored into JSON, please add a check to not have it happening

I believe the system got out of space during the process (but no indication of this whatsoever)

The issue might not be reproduce-able, but the code is probably lacking some undefined check while writing to the json, which is breaking it

✔ Completed inspectHtmlTask for /blog. (Time Taken: 0.5s 2.25 MB 39% complete) Unlighthouse 11:57:08 AM [Unlighthouse 11:57:08 AM] ✔ Completed inspectHtmlTask for /blog/aposentadoria-semina. (Time Taken: 0.1s 60.69 KB 41% complete) [Unlighthouse 11:57:08 AM] ✔ Completed inspectHtmlTask for /blog/aposentadoria-especial-frentista. (Time Taken: 0.1s 125.76 KB 43% complete) [Unlighthouse 11:57:08 AM] ✔ Completed inspectHtmlTask for /blog/aposentei-sem-tempo-rural-e-agora. (Time Taken: 0.1s 66.92 KB 44% complete) [Unlighthouse 11:57:09 AM] ✔ Completed inspectHtmlTask for /blog/avanco-pericia-medica-inss. (Time Taken: 0.2s 44.61 KB 46% complete) [Unlighthouse 11:57:09 AM] ✔ Completed inspectHtmlTask for /blog/estrategia-do-duplo-requerimento-previdenciario. (Time Taken: 0.2s 55.92 KB 47% complete) [Unlighthouse 11:57:09 AM] ✔ Completed inspectHtmlTask for /blog/guia-completo-rural-segurado-especial. (Time Taken: 0.3s 116.04 KB 49% complete) [Unlighthouse 11:57:09 AM] ✔ Completed inspectHtmlTask for /blog/sucumbencia-previdenciaria-um-entendimento-injusto. (Time Taken: 0.3s 43.37 KB 50% complete) [Unlighthouse 11:57:09 AM] ✔ Completed inspectHtmlTask for /blog/teto-minimo-teto-maximo. (Time Taken: 0.2s 76.3 KB 51% complete) [Unlighthouse 11:57:09 AM] ✔ Completed runLighthouseTask for /. (Time Taken: 0.2s Score: 0.97 Samples: 1 52% complete) [Unlighthouse 11:57:10 AM] ✔ Completed runLighthouseTask for /advogado/eduardo-walber. (Time Taken: 0.2s Score: 0.97 Samples: 1 55% complete) [Unlighthouse 11:57:10 AM] ✔ Completed runLighthouseTask for /advogado/joao-prado. (Time Taken: 0.1s Score: 0.93 Samples: 1 57% complete) [Unlighthouse 11:57:10 AM] ✔ Completed runLighthouseTask for /aposentadoria-coveiro. (Time Taken: 0.1s Samples: 1 60% complete) undefined:1

SyntaxError: /home/skid/.unlighthouse/pellizzetti.adv.br/0b95/reports/aposentadoria-frentista-caixa/lighthouse.json: Unexpected end of JSON input at JSON.parse () at Object.readFileSync (/home/skid/.npm/_npx/944abecbf21dfffb/node_modules/jsonfile/index.js:52:17) at runLighthouseTask (file:///home/skid/.npm/_npx/944abecbf21dfffb/node_modules/@unlighthouse/core/dist/index.mjs:1358:24) at file:///home/skid/.npm/_npx/944abecbf21dfffb/node_modules/@unlighthouse/core/dist/index.mjs:1531:16 at Worker. (/home/skid/.npm/_npx/944abecbf21dfffb/node_modules/puppeteer-cluster/dist/Worker.js:55:68) at Generator.next () at fulfilled (/home/skid/.npm/_npx/944abecbf21dfffb/node_modules/puppeteer-cluster/dist/Worker.js:5:58)

Node.js v20.9.0

Reproduction

npx unlighthouse --site pellizzetti.adv.br

System / Nuxt Info

  System:
    OS: Linux 6.6 Kali GNU/Linux Rolling 2024.2
    CPU: (8) x64 Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz
    Memory: 2.05 GB / 7.62 GB
    Container: Yes
    Shell: 5.9 - /usr/bin/zsh
  Binaries:
    Node: 20.9.0 - ~/.nvm/versions/node/v20.9.0/bin/node
    Yarn: 4.4.1 - ~/.yarn/bin/yarn
    npm: 10.1.0 - ~/.nvm/versions/node/v20.9.0/bin/npm
  Browsers:
    Chromium: 124.0.6367.118
wh1t3h47 commented 5 hours ago

It is confirmed due to lack of storage

However this generates a broken .unlighthouse directory, which keeps crashing on the same page due to the incorrectly dumped json into the file