question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Unable to fetch webSocketDebuggerUrl with headless_shell

See original GitHub issue

I realize this is on the edge, but currently when running lighthouse-cli or using lighthouse-core in custom scripts, cri.js will throw an error and exit when running against the headless_shell built from the tip (as of Nov 17):

status Disconnecting from browser... +0ms
Runtime error encountered: Error: Unable to fetch webSocketDebuggerUrl, status: 500
    at IncomingMessage.response.on._ (/usr/local/lib/node_modules/lighthouse/lighthouse-core/gather/connections/cri.js:79:18)
    at emitNone (events.js:91:20)
    at IncomingMessage.emit (events.js:185:7)
    at endReadableNT (_stream_readable.js:974:12)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)

This is caused by CriConnection connect() method calling /json/new. In this case, headless_shell will return “Cannot create new page” as the /json/new API does not exist in headless_shell as per https://bugs.chromium.org/p/chromium/issues/detail?id=626847.

My question: leave the existing behavior and wait for 626847 to add the the backwards compatibility for /json/new or handle this in the new Browser.createTarget DevTools command?

Note: if anyone is reading this and you still want to run against headless_shell now, you can temporarily peg to 1.1.6 before the Connection refactor occurred.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:11 (8 by maintainers)

github_iconTop GitHub Comments

5reactions
pavelfeldmancommented, Nov 18, 2016

We need to do something on chromium side to make you happy. Just filed this: https://bugs.chromium.org/p/chromium/issues/detail?id=666865. Once it is fixed, you can issue “Target.createTarget” while connected to the predefined “ws://localhost:9222/devtools/browser” endpoint. We might want to throw a secure GUID into that path to protect your clients from random pages attempting to connect to the endpoint. That way it does not require the flag, but you need to have a way of parsing the GUID out from the chrome stdout.

1reaction
paulirishcommented, Aug 2, 2017

We need to do something on chromium side to make you happy. Just filed this: https://bugs.chromium.org/p/chromium/issues/detail?id=666865. Once it is fixed, you can issue “Target.createTarget” while connected to the predefined “ws://localhost:9222/devtools/browser” endpoint.

FYI: A patch is up for this https://chromium-review.googlesource.com/c/596719

Read more comments on GitHub >

github_iconTop Results From Across the Web

Requesting webSocketDebuggerUrl from Chrome-Headless ...
Problem. To actually connect to chrome inside the container, I first need to retrieve the webSocketDebuggerUrl, which is available at http://0.0 ...
Read more >
chromedp - Go Packages
Package chromedp is a high level Chrome DevTools Protocol client that simplifies driving browsers for scraping, unit testing, or profiling ...
Read more >
headless chrome & aws lambda - Google Groups
So far, in the context of the AWS Lambda environment, I've only been able to get the headless shell to run with the...
Read more >
Getting to Know Puppeteer Using Practical Examples
Your browser can't play this video. ... Then, we simply fetch the webSocketDebuggerUrl value of the created ... Triggers `error` event.
Read more >
chromedp/headless-shell - Docker Image
Minimal container for Chrome's headless shell, useful for automating / driving the ... if headless-shell is crashing with a BUS_ADRERR error, pass a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found