Skip to content
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

node --inspect devtoolsFrontendUrl using docker container IP #13294

Closed
mrguiman opened this issue May 30, 2017 · 4 comments
Closed

node --inspect devtoolsFrontendUrl using docker container IP #13294

mrguiman opened this issue May 30, 2017 · 4 comments
Labels
inspector Issues and PRs related to the V8 inspector protocol

Comments

@mrguiman
Copy link

mrguiman commented May 30, 2017

Version: v7.10.0
Platform: Linux fad72c3b2219 4.9.27-moby #1 SMP Thu May 11 04:01:18 UTC 2017 x86_64 GNU/Linux

Hi,

Running node 7.10.0 on a Docker Container, version: 17.03.1-ce-mac12 (17661), channel: stable.

For development purposes, I'm running node with --inspect with the following command:
./node_modules/.bin/nodemon --inspect=0.0.0.0:9229 index.js

Console output following this is:
chrome-devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=0.0.0.0:9229/79ee5f22-17fa-4878-baf5-1aed2b8ca12b
This works fine and lets me inspect and drop breakpoints inside my code.

However, I'm trying to use NIM to automatically pickup and open the new devtools url when my code changes.
NIM takes the devtoolsFrontendUrl from http://localhost:9229/json, which in this current case is:
chrome-devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=172.18.0.2:9229/79ee5f22-17fa-4878-baf5-1aed2b8ca12b
This does not work: I can't inspect my code through this url.

Essentially, devToolsFrontendUrl spits out my container's IP whereas the console log correctly uses the 0.0.0.0 IP that I provided to --inspect
I'm forced to change the ip to 0.0.0.0 to make it work.

Any idea why it behaves that way, and what I can do to automatically pickup the correct address ?

Thanks

@watilde watilde added the inspector Issues and PRs related to the V8 inspector protocol label May 30, 2017
@mrguiman
Copy link
Author

mrguiman commented Jun 2, 2017

Bumping this with my experiments with Node 8

So things are a little different this time around since node 8 does not spit out the devtoolFrontendUrl in the console, the issue however is still the same, the url uses the docker container IP, which does not work. Replacing the container ip with localhost (or 0.0.0.0 depending on the host' system) does work.

I've created a small repository and a docker image to illustrate the issue

https://github.com/MrGuiMan/docker-node-inspector-test
https://hub.docker.com/r/mrguiman/docker-node-inspector/

@Trott
Copy link
Member

Trott commented Apr 29, 2018

Is this still an issue in Node.js 10.0.0?

@mrguiman
Copy link
Author

@Trott
Confirming this works on Node 10.0.0, url picked up by NiM now looks like:

chrome-devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=localhost:9229/d2041836-cda3-43b2-9562-256c6a57f0b0

@TimothyGu
Copy link
Member

Fixed in #19664, probably.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inspector Issues and PRs related to the V8 inspector protocol
Projects
None yet
Development

No branches or pull requests

4 participants