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.

target option is broken

See original GitHub issue

target option is broken: https://github.com/cyrus-and/chrome-remote-interface#cdpoptions-callback

const port = 52999;
const target = await CDP.New({ port });
console.log('target:', target);
/*
target: { description: '',
  devtoolsFrontendUrl: '/devtools/inspector.html?ws=localhost:52999/devtools/page/5a5fabc4-1c6c-40c1-9181-81c56ac31707',
  id: '5a5fabc4-1c6c-40c1-9181-81c56ac31707',
  title: '',
  type: 'page',
  url: 'about:blank',
  webSocketDebuggerUrl: 'ws://localhost:52999/devtools/page/5a5fabc4-1c6c-40c1-9181-81c56ac31707' }
*/
const client = await CDP({ target });

Produces the error:

{ Error: connect ECONNREFUSED 127.0.0.1:9222
    at Object._errnoException (util.js:1019:11)
    at _exceptionWithHostPort (util.js:1041:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1175:14)
  code: 'ECONNREFUSED',
  errno: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 9222 }

It seems the default port has precedence: https://github.com/cyrus-and/chrome-remote-interface/blob/master/lib/devtools.js#L103-L104

Component Version
Operating system macOS / Ubuntu 16.04 / Docker
Node.js v8.6.0
Chrome/Chromium/… Chrome 61.0.3163.100
chrome-remote-interface 0.25.1

Is Chrome running in a container? I’ve tried both options.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
cyrus-andcommented, Oct 9, 2017

Wow, I apologize, I had a running background Chrome instance on port 9222… 😕

I’m going to fix this, in the meanwhile just pass the port in addition to the target, like this:

const client = await CDP({ target , port: chrome.port });
1reaction
cyrus-andcommented, Oct 17, 2017

Bumped: v0.25.2.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Order issues - Target Help
Visit here if your order was damaged or defective and delivered by EFW or FragilePAK. You may exchange or return the item in...
Read more >
Target.com down? Current outages and problems
Real-time outages and problems for Target.com. ... Select the option you are having issues with, and help provide feedback to the service.
Read more >
"Track the locked target" setting broken since update 0.11.10.
In the "Controls" section of the game options there is a setting called "Track the locked target". This setting has been broken since...
Read more >
Boot MBP in Target Disk Mode with Broken
I've already tried, and for some unclear reason it doesn't work. So my next option is to use another MBP to load the...
Read more >
Target is broken and needs to be reset - Intel Communities
This message means that the target processor didn't go into debug mode when it was asked to. The most common reasons for this...
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