Skip to content

inspector: add ability to use a constant websocket url #13840

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ArnaudRinquin opened this issue Jun 21, 2017 · 7 comments
Closed

inspector: add ability to use a constant websocket url #13840

ArnaudRinquin opened this issue Jun 21, 2017 · 7 comments
Labels
feature request Issues that request new features to be added to Node.js. inspector Issues and PRs related to the V8 inspector protocol

Comments

@ArnaudRinquin
Copy link

ArnaudRinquin commented Jun 21, 2017

Using node 8.x.x gives the ability use the Chrome DevTools and that's a great help.

One thing that make the developer experience a bit less pleasant is the random bit of the web socket url because it forces this workflow:

  1. start app
  2. grab debugger url (looks like to: chrome-devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=127.0.0.1:9229/dc9010dd-f8b8-4ac5-a510-c1a114ec7d29)
  3. copy paste in chrome
  4. debug
  5. change code
  6. goto 1.

Step 2. and 3. are very tedious, especially when your app spits logs at startup. If the url was always the same, a simple refresh of the debug tab would be enough.

I understand there might be reasons for the url to be random (security?) but that'd be really nice to have the ability to make it constant.

I know a workaround would be to use inspector.url() to grab the url and open it programatically but Chrome does not allow that. As stated in this issue, it seems impossible to open Chrome Devtools in anyway other than copy-pasting the url in the bar.

@vsemozhetbyt
Copy link
Contributor

vsemozhetbyt commented Jun 21, 2017

You can also keep chrome://inspect/#devices open, there will be a live (new) link there for each new inspect session from Node.js (at least in Chrome 61).

@ArnaudRinquin
Copy link
Author

@vsemozhetbyt I've tried that but the detection doesn't seem to work when using node within a docker(-compose) context, even when adding hosts. Accessing through the url works though.

@vsemozhetbyt vsemozhetbyt added the inspector Issues and PRs related to the V8 inspector protocol label Jun 21, 2017
@vsemozhetbyt
Copy link
Contributor

cc @nodejs/v8-inspector

@refack refack added the feature request Issues that request new features to be added to Node.js. label Jun 21, 2017
@cjihrig
Copy link
Contributor

cjihrig commented Jun 21, 2017

@ArnaudRinquin there are a number of Chrome extensions that were made to mitigate this problem. They even support automatic reconnection. Do any of them work for you?

Related issue: #9185

@ArnaudRinquin
Copy link
Author

@cjihrig I've tried NIM without success. According to the websocket address, It tried to connect to the docker-machine without success.

@benjamingr
Copy link
Member

Ping @paulirish for the devtools issue of not showing up.

@ArnaudRinquin
Copy link
Author

A good night of sleep (actually it was a bod one) made me realise the potential cause of the issue: in our docker-compose environment we use nginx as a reverse proxy and I initially proxied the inspector websocket as well. Disabling the websocket proxy route and directly exposing the nodejs machine 9229 port fixed the issue and I can now find my instance in chrome://inspect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issues that request new features to be added to Node.js. inspector Issues and PRs related to the V8 inspector protocol
Projects
None yet
Development

No branches or pull requests

5 participants