lighthouse: "Ni.connect is not a function" when testing in DevTools

Developer’s Note

The fix for this should be released on all Chrome channels:

Stable - 116.0.5845.140 Beta - 117.0.5938.35 Dev - 118.0.5951.0 Canary - 118.0.5939.0

If you are still experiencing this issue, please verify that your Chrome is up to date before reporting.


FAQ

URL

https://mini-project-lighthouse.herokuapp.com/

What happened?

When trying to run an audit, received an error and was unable produce an audit. Sometimes and audit would work, but only the PWA audit report was displayed/created.

What did you expect?

Expected to generate a full audit report. All audit settings selected. Only the PWA section was generated sometimes. Issues replicated in incognito.

What have you tried?

Using latest chrome browser, restarted browser, removed/re-installed extension, and allowed incognito extension use.

How were you running Lighthouse?

WebPageTest

Lighthouse Version

100.0.0

Chrome Version

115.0.5790.102

Node Version

No response

OS

Windows 10

Relevant log output

Ni.connect is not a function

Channel: DevTools
Initial URL: https://mini-project-lighthouse.herokuapp.com/
Chrome Version: 115.0.0.0
Stack Trace: TypeError: Ni.connect is not a function
    at devtools://devtools/bundled/devtools-frontend/front_end/third_party/lighthouse/lighthouse-dt-bundle.js:618:972
    at Runner.gather (devtools://devtools/bundled/devtools-frontend/front_end/third_party/lighthouse/lighthouse-dt-bundle.js:524:349)
    at navigationGather (devtools://devtools/bundled/devtools-frontend/front_end/third_party/lighthouse/lighthouse-dt-bundle.js:618:858)
    at async navigation (devtools://devtools/bundled/devtools-frontend/front_end/third_party/lighthouse/lighthouse-dt-bundle.js:620:940)
    at async i (devtools://devtools/bundled/devtools-frontend/front_end/entrypoints/lighthouse_worker/lighthouse_worker.js?remoteBase=https%3A%2F%2Fchrome-devtools-frontend.appspot.com%2Fserve_file%2F%4090efd4b0ad6aa15eeafcdabd5817ae939f7ba059%2F:1:2668)
    at async self.onmessage (devtools://devtools/bundled/devtools-frontend/front_end/entrypoints/lighthouse_worker/lighthouse_worker.js?remoteBase=https%3A%2F%2Fchrome-devtools-frontend.appspot.com%2Fserve_file%2F%4090efd4b0ad6aa15eeafcdabd5817ae939f7ba059%2F:1:3056)

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 21
  • Comments: 33 (7 by maintainers)

Commits related to this issue

Most upvoted comments

I am on Vivaldi, and the error persists.

I am on Vivaldi, and the error persists.

To avoid other Vivaldi users repeating my work, I have filed a report relating to this issue with Vivaldi: VB-99984

This started occurring for me after updating to Version 115.0.5790.102 (Official Build) (x86_64), MacOS 13.4, all Lighthouse modes unavailable.

When mode = Navigation:

Ni.connect is not a function

Channel: DevTools
Initial URL: https://xxx
Chrome Version: 115.0.0.0
Stack Trace: TypeError: Ni.connect is not a function
    at devtools://devtools/bundled/devtools-frontend/front_end/third_party/lighthouse/lighthouse-dt-bundle.js:618:972
    at Runner.gather (devtools://devtools/bundled/devtools-frontend/front_end/third_party/lighthouse/lighthouse-dt-bundle.js:524:349)
    at navigationGather (devtools://devtools/bundled/devtools-frontend/front_end/third_party/lighthouse/lighthouse-dt-bundle.js:618:858)
    at async navigation (devtools://devtools/bundled/devtools-frontend/front_end/third_party/lighthouse/lighthouse-dt-bundle.js:620:940)
    at async i (devtools://devtools/bundled/devtools-frontend/front_end/entrypoints/lighthouse_worker/lighthouse_worker.js?remoteBase=https%3A%2F%2Fchrome-devtools-frontend.appspot.com%2Fserve_file%2F%4090efd4b0ad6aa15eeafcdabd5817ae939f7ba059%2F:1:2668)
    at async self.onmessage (devtools://devtools/bundled/devtools-frontend/front_end/entrypoints/lighthouse_worker/lighthouse_worker.js?remoteBase=https%3A%2F%2Fchrome-devtools-frontend.appspot.com%2Fserve_file%2F%4090efd4b0ad6aa15eeafcdabd5817ae939f7ba059%2F:1:3056)

When mode = Timespan, notification of timespan started and you can interact with the page, however on stopping the following is thrown:

Cannot end a timespan before starting one

Channel: DevTools
Initial URL: https://xxx
Chrome Version: 115.0.0.0
Stack Trace: Error: Cannot end a timespan before starting one
    at i (devtools://devtools/bundled/devtools-frontend/front_end/entrypoints/lighthouse_worker/lighthouse_worker.js?remoteBase=https%3A%2F%2Fchrome-devtools-frontend.appspot.com%2Fserve_file%2F%4090efd4b0ad6aa15eeafcdabd5817ae939f7ba059%2F:1:976)
    at self.onmessage (devtools://devtools/bundled/devtools-frontend/front_end/entrypoints/lighthouse_worker/lighthouse_worker.js?remoteBase=https%3A%2F%2Fchrome-devtools-frontend.appspot.com%2Fserve_file%2F%4090efd4b0ad6aa15eeafcdabd5817ae939f7ba059%2F:1:3062)

When mode = Snapshot

Cannot read properties of null (reading ‘target’)

Channel: DevTools
Initial URL: https://xxx
Chrome Version: 115.0.0.0
Stack Trace: TypeError: Cannot read properties of null (reading 'target')
    at Driver.connect (devtools://devtools/bundled/devtools-frontend/front_end/third_party/lighthouse/lighthouse-dt-bundle.js:603:762)
    at snapshotGather (devtools://devtools/bundled/devtools-frontend/front_end/third_party/lighthouse/lighthouse-dt-bundle.js:621:282)
    at async snapshot (devtools://devtools/bundled/devtools-frontend/front_end/third_party/lighthouse/lighthouse-dt-bundle.js:621:88)
    at async i (devtools://devtools/bundled/devtools-frontend/front_end/entrypoints/lighthouse_worker/lighthouse_worker.js?remoteBase=https%3A%2F%2Fchrome-devtools-frontend.appspot.com%2Fserve_file%2F%4090efd4b0ad6aa15eeafcdabd5817ae939f7ba059%2F:1:2446)
    at async self.onmessage (devtools://devtools/bundled/devtools-frontend/front_end/entrypoints/lighthouse_worker/lighthouse_worker.js?remoteBase=https%3A%2F%2Fchrome-devtools-frontend.appspot.com%2Fserve_file%2F%4090efd4b0ad6aa15eeafcdabd5817ae939f7ba059%2F:1:3056)

SOLVED (for me) - by restarting Chrome.

Good to know

  • Running in a Private tab works best
  • I found that having multiple Private tabs can cause this problem too - so you may want to check for other tabs running Lighthouse

Hi. Dev here.

We’re having trouble reproducing this so… if you want to poke around… we’d appreciate some more debugging details.

Unfortunately since we run lighthouse in a webworker… this is not trivial debugging.

  1. undock devtools. ctrl-shift-i to inspect devtools. now you have devtools on devtools (we’ll call this DoD). optionally redock the first devtools.
  2. in DoD, ctrl-o and look for lighthouse.js place a breakpoint within initWorker’s onmessage callback image
  3. in page DevTools, start Lighthouse with ‘Analyze Page Load’ the DoD debugger should pause on your new breakpoint
  4. You can now remove the breakpoint (otherwise it’ll get annoying)
  5. you should also now see a lighthouse_worker.js in DoD threads now: image
  6. in the DoD, ctrl-o for puppeteer.js, go to the very bottom and place a breakpoint on the return statement: image
  7. resume script execution. you should pause on the new breakpoint
  8. log out e
  9. log out l.pages().then(pages => console.warn(pages.length)) image
  10. resume and view the last log

image

A e.mainFrameId that’s undefined/null would be a problem And… a length of 0 would also be very surprising. But… both might indicate the problem.

Thanks

I’m running into the same error on 115.0.5790.114

same as above. now have Mi.connect is not a function error

Channel: DevTools
Initial URL: <some_url>
Chrome Version: 116.0.0.0
Stack Trace: TypeError: Mi.connect is not a function
    at devtools://devtools/bundled/devtools-frontend/front_end/third_party/lighthouse/lighthouse-dt-bundle.js:624:662
    at Runner.gather (devtools://devtools/bundled/devtools-frontend/front_end/third_party/lighthouse/lighthouse-dt-bundle.js:527:132)
    at navigationGather (devtools://devtools/bundled/devtools-frontend/front_end/third_party/lighthouse/lighthouse-dt-bundle.js:624:548)
    at async navigation (devtools://devtools/bundled/devtools-frontend/front_end/third_party/lighthouse/lighthouse-dt-bundle.js:626:696)
    at async i (devtools://devtools/bundled/devtools-frontend/front_end/entrypoints/lighthouse_worker/lighthouse_worker.js?remoteBase=https%3A%2F%2Fchrome-devtools-frontend.appspot.com%2Fserve_file%2F%401a391816688002153ef791ffe60d9e899a71a037%2F:1:2668)
    at async self.onmessage (devtools://devtools/bundled/devtools-frontend/front_end/entrypoints/lighthouse_worker/lighthouse_worker.js?remoteBase=https%3A%2F%2Fchrome-devtools-frontend.appspot.com%2Fserve_file%2F%401a391816688002153ef791ffe60d9e899a71a037%2F:1:3056)

MacOS 13.4.1

metoo,MacOs 12.5 ,Chrome version 116.0.5845.96

The same error (incognito or not - doesn’t matter)

Mi.connect is not a function

Channel: DevTools
Initial URL: <some_url>
Chrome Version: 116.0.0.0
Stack Trace: TypeError: Mi.connect is not a function
    at devtools://devtools/bundled/devtools-frontend/front_end/third_party/lighthouse/lighthouse-dt-bundle.js:624:662
    at Runner.gather (devtools://devtools/bundled/devtools-frontend/front_end/third_party/lighthouse/lighthouse-dt-bundle.js:527:132)
    at navigationGather (devtools://devtools/bundled/devtools-frontend/front_end/third_party/lighthouse/lighthouse-dt-bundle.js:624:548)
    at async navigation (devtools://devtools/bundled/devtools-frontend/front_end/third_party/lighthouse/lighthouse-dt-bundle.js:626:696)
    at async i (devtools://devtools/bundled/devtools-frontend/front_end/entrypoints/lighthouse_worker/lighthouse_worker.js?remoteBase=https%3A%2F%2Fchrome-devtools-frontend.appspot.com%2Fserve_file%2F%401a391816688002153ef791ffe60d9e899a71a037%2F:1:2668)
    at async self.onmessage (devtools://devtools/bundled/devtools-frontend/front_end/entrypoints/lighthouse_worker/lighthouse_worker.js?remoteBase=https%3A%2F%2Fchrome-devtools-frontend.appspot.com%2Fserve_file%2F%401a391816688002153ef791ffe60d9e899a71a037%2F:1:3056)

MacOS, Version 116.0.5845.96 (Official Build) (arm64)