3
votes

I'm trying to remote debug my nodejs application (which is actually running on a docker container in my local machine but for all purposes is treated as a remote host)

I've ran the app with nodemon using the following command in my docker-compose file

nodemon --debug=3010 app.js

Then opened the port for the container and used port-forwarding for the port to be available in localhost:3010.

Later I've setup the following configuration in intellij remote debugger plugin:

host: localhost
port: 3010

Now, when running the code in the container, the code doesn't stop on my breakpoint. I'm pretty sure I should launch the configuration I've set up for remote debugging, but don't really see how.

I've also tried setting the host parameter of the remote debugging plugin to the docker-machine ip, but this also gave no result.

What should I do to make intellij stop when the code reaches my breakpoint?

1
It wasn't clear from your description, but did you connect to Node using your debugger configuration from IntelliJ via Run -> Debug -> ... ? - mikebridge
No, I was basically asking how could I do this, sorry if I wasn't clear enough. I've looked at this again now after reading your comment, and found the option. I'm debugging just fine now, thanks! - Yaron Idan
Glad you got it working! - mikebridge
@YaronIdan please answer your own question to ensure users in the future to find the answer you found. - Harmelodic
Right you are, done! - Yaron Idan

1 Answers

4
votes

In order to launch the configuration I had to go to run -> debug and then choose edit configuration. In the configuration window I've added a new configuration of the "Node.js Remote Debug" type, and then pressed the debug button at the bottom of the screen. Hope this helps future wanderers.