• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home ยป Resolved: VSCode debugger refuses to attach to node process with no error or logs?

Resolved: VSCode debugger refuses to attach to node process with no error or logs?

0
By Isaac Tonny on 18/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

We’re using node v18.3.0
I’m starting my nestjs app, inside a docker container, with this command nest start -e \"node --inspect-brk\". Which gives the following output:
So it looks like it’s waiting for a debugger to attach – excellent!
I have forwarded port 9229 on the docker container, docker ps:
And I can telnet to that port from the host machine telnet localhost 9229:
This is my launch.json:
But when I launch the debugger I just get this little progress bar for a few seconds and then the debugger stops: enter image description here
But there’s no error log or anything so I have no idea how to fix this. Any help is greatly appreciated!

Answer:

For debugging a NodeJS application running a docker 127.0.0.1 interface wont reach the docker network try using 0.0.0.0.
In the debug command at the package json change it to nest start -e \"node --inspect-brk=0.0.0.0:9229\"
The 0.0.0.0 will tell the debugger to look at all available local network interfaces.
In the vscode debug configuration "address": "0.0.0.0" and it is recommended to use "remoteRoot" and "localRoot" directives for syncing the position of the current vscode work directory files to the files in the docker file system.

If you have better answer, please add a comment about this, thank you!

docker node-inspector node.js visual-studio-code vscode-debugger
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: what are the permissions required to assign a resource monitor to a warehouse?

01/04/2023

Resolved: How can I modify formData before sending it?

01/04/2023

Resolved: How to efficient create SimpleITK image?

01/04/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.