foo-software / lighthouse-check-action

GitHub Action for running @GoogleChromeLabs Lighthouse audits with all the bells and whistles 🔔 Multiple audits, Slack notifications, and more!
https://github.com/marketplace/actions/lighthouse-check
MIT License
471 stars 24 forks source link

Actions fails with "Error: Table must define at least one column." #96

Closed martincostello closed 2 years ago

martincostello commented 2 years ago

Describe the bug

I've been experimenting with running Lighthouse against my personal website using this action as a proof-of-concept, but the action consistently fails with the error shown below.

lighthouse-check: Auditing desktop (1/2): https://localhost:5001
lighthouse-check: Auditing mobile (2/2): https://localhost:5001

+--------------------------------------------------------------------------+
|                             Lighthouse Audit                             |
+--------------------------------------------------------------------------+

URL: https://localhost:5001
Device: desktop
lighthouse-check:

 Error: Table must define at least one column.
    at validateTableData (/home/runner/work/_actions/foo-software/lighthouse-check-action/v8.0.1/node_modules/table/dist/validateTableData.js:30:11)
    at table (/home/runner/work/_actions/foo-software/lighthouse-check-action/v8.0.1/node_modules/table/dist/table.js:96:34)
    at /home/runner/work/_actions/foo-software/lighthouse-check-action/v8.0.1/node_modules/@foo-software/lighthouse-check/dist/logResults.js:56:34
    at Array.forEach (<anonymous>)
    at _default (/home/runner/work/_actions/foo-software/lighthouse-check-action/v8.0.1/node_modules/@foo-software/lighthouse-check/dist/logResults.js:39:11)
    at /home/runner/work/_actions/foo-software/lighthouse-check-action/v8.0.1/node_modules/@foo-software/lighthouse-check/dist/lighthouseCheck.js:[22](https://github.com/martincostello/website/runs/6728443395?check_suite_focus=true#step:5:23)3:[33](https://github.com/martincostello/website/runs/6728443395?check_suite_focus=true#step:5:34)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
Error: Table must define at least one column.

I wondered if it might be erroring due to some sort of facet of running against localhost on the GitHub Actions runner, but pointing it at my actual site had the same error.

To Reproduce

View the workflow added in this Pull Request: https://github.com/martincostello/website/pull/1040

Expected behavior

The workflow renders the Lighthouse report and does not fail.

adamhenson commented 2 years ago

Hi @martincostello. That is a strange error message. Haven't seen that one before. Sorry, it's not intuitive. I would start with some debugging and replace the Lighthouse block with a step that just does a curl on https://localhost:5001 or something like that.

Once I have some time I'll take a look at foo-software/lighthouse-check to look for that error message and figure out why we don't surface something better.

martincostello commented 2 years ago

After some further debugging as suggested, looks like the root problem was that the site wasn't starting up (and then I wasn't waiting long enough for it to start with that fixed). With that resolved, I get results as expected. Mostly a case of copying some "works on my machine" commands from Windows, and expecting them to work as-is on a Linux CI agent 😅.

I guess the action just isn't handling connection failures nicely, then leading it into the code to render the table erroring.

adamhenson commented 2 years ago

Glad you got to the bottom of it @martincostello. Yes, the GitHub Action wasn't surfacing Lighthouse runtimeError. In cases like this, Lighthouse actually does run and complete, but scores have a null value. The only data I've found related to this outcome in the Lighthouse response is in result.runtimeError.message. Previously, any falsey score values were substituted with 0, to fulfill any downstream dependency until !82... which is why your issue surfaced... because the broken contract was left uncaught.

Anyways, today I discovered result.runtimeError.message which I leveraged to surface errors and prevent this thrown exception.