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

Cannot read properties of undefined (reading 'settings') #77

Closed pratikaisle3 closed 2 years ago

pratikaisle3 commented 2 years ago

Describe the bug I am using foo-software/lighthouse-check-action@master in my pipeline and I am getting this error Cannot read properties of undefined (reading 'settings')

To Reproduce So I have my workflow file in which I'm using foo-software/lighthouse-check-action@master for lighspeed test but that step is failing with below error

lighthouse-check:
 TypeError: Cannot read properties of undefined (reading 'settings')
    at localLighthouse (/home/runner/work/_actions/foo-software/lighthouse-check-action/master/node_modules/@foo-software/lighthouse-check/dist/localLighthouse.js:54:44)
    at getLocalLighthouseResultsWithRetries (/home/runner/work/_actions/foo-software/lighthouse-check-action/master/node_modules/@foo-software/lighthouse-check/dist/localLighthouse.js:124:35)
    at _default (/home/runner/work/_actions/foo-software/lighthouse-check-action/master/node_modules/@foo-software/lighthouse-check/dist/localLighthouse.js:***9:41)
    at /home/runner/work/_actions/foo-software/lighthouse-check-action/master/node_modules/@foo-software/lighthouse-check/dist/lighthouseCheck.js:175:67
    at new Promise (<anonymous>)
    at _default (/home/runner/work/_actions/foo-software/lighthouse-check-action/master/node_modules/@foo-software/lighthouse-check/dist/lighthouseCheck.js:69:7)
    at /home/runner/work/_actions/foo-software/lighthouse-check-action/master/dist/index.js:65:70
    at Object.<anonymous> (/home/runner/work/_actions/foo-software/lighthouse-check-action/master/dist/index.js:104:3)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
Error: Cannot read properties of undefined (reading 'settings')

Expected behavior Generally, it was working fine till Dec 28 2021 but you made recent changes on Dec 3 after that I am seeing this error in my pipeline please find attached files

Additional context Add any other context about the problem here. Screenshot_8 actions.txt

pratikaisle3 commented 2 years ago

I had tested this on tag 7.1.0 seems you made some changes today on 7.1.1 let me test it!

adamhenson commented 2 years ago

I have some major concerns here. You are running this against a fork AISLE-3/lighthouse-check-action@7.0.0. It looks like you even released a version of this fork and published to the marketplace. Please contact GitHub to have this removed from the marketplace immediately.

I see many things that are wrong, just at a glance. It does not follow the documentation whatsoever.

For example, this block:

      - name: Lighthouse
        id: running-lightspeed-test
        uses: AISLE-3/lighthouse-check-action@7.0.0
        with:
          urls: 'https://idevops.tech'
          slackWebhookUrl: ${{ secrets.SLACK_WEBHOOK }}
          device: 'desktop,mobile'

device: 'desktop,mobile' is not valid. You would want to use device: 'all'. My guess is that this is causing the error because settings property isn't found... meaning its parent is probably undefined.

You then do this:

      - name: Verify Lighthouse Check results
        uses: AISLE-3/lighthouse-check-action@7.0.0
        with:
          lighthouseCheckResults: ${{ steps.running-lightspeed-test.outputs.lighthouseCheckResults }}
          minAccessibilityScore: "75"s
          minBestPracticesScore: "75"
          minPerformanceScore: "65"
          minProgressiveWebAppScore: "90"
          minSeoScore: "50"

We have a separate action to handle the results, but you're using the same one uses: AISLE-3/lighthouse-check-action@7.0.0. As you can see in the docs, you would use a different action foo-software/lighthouse-check-status-action.

Also in this line - you have a trailing s which is invalid: minAccessibilityScore: "75"s.

I can tell that this is a problem with the configuration as it doesn't follow the documentation whatsoever. What's even more disturbing is that the fork has different code in it and you even went as far as publishing to the marketplace... and then opening an issue here for a problem with your fork.

Please have your fork release unpublished and removed from the marketplace immediately.

I'm closing this because foo-software/lighthouse-check-action is working as expected and the issue here is obviously with the fork AISLE-3/lighthouse-check-action.

pratikaisle3 commented 2 years ago

Thanks, i have delisted my app i want to use the older version 7.0.0 which I think that was working! but when I try to pull 7.0.0 from your repository so it says version not found so I don't have any other option to fork the repo till 7.0.0 and host it in my workplace so I removed the app from the marketplace you can verify and last changes you made also fix my issue 7.1.1 with that it working as expected.

however, I commented device section which you said wrong but under document, I can see

device#
Type: 'desktop' | 'mobile' | undefined

The device in which to run Lighthouse.

So how to use this feature within the pipeline

     - name: Lighthouse
        id: running-lightspeed-test
        uses: foo-software/lighthouse-check-action@master
        with:
          urls: 'https://idevops.tech'
          slackWebhookUrl: ${{ secrets.SLACK_WEBHOOK }}
          device: 'desktop,mobile'
adamhenson commented 2 years ago

Why do you want to use 7.0.0? Please use the latest version instead.

when I try to pull 7.0.0 from your repository so it says version not found

That doesn't make sense. It's right here: https://github.com/foo-software/lighthouse-check-action/releases/tag/v7.0.0

The documentation seems to be missing this which is what I think you're looking for:

device: 'all'`

Also, remember - there is one other thing you have wrong:

      - name: Verify Lighthouse Check results
        uses: AISLE-3/lighthouse-check-action@7.0.0

There is a different action to handle the result: foo-software/lighthouse-check-status-action

pratikaisle3 commented 2 years ago

Thanks for help everything is sorted with latest version