0
votes

I want to start debugging node.js app using Intellij and node.js interpreter running on Docker. While running the app works, when I try to debug I get the error:

Error running 'index.js' com.github.dockerjava.api.exception.InternalServerErrorException: {"message":"driver failed programming external connectivity on endpoint focused_poincare (a17137973880d1be7c6a74fc142184fdda31e0dec8ebd539b09d9dbe4cf70014): Error starting userland proxy: Bind for 0.0.0.0:55578 failed: port is already allocated"}

Remote interpreter was configured acccording to the documentation. I have created a new Node.js Run/Debug configuration and entered the following data: node.js remote interpreter configuration.

What might be the cause for debugging not working?

I use:

  • Intellij Idea Ultimate v. 2019.1.4 Preview
  • Intellij NodeJS plugin v. 191.7479.1, NodeJS remote interpreter plugin v. 191.6014.8 and Docker plugin v. 191.7141.44
  • Docker Desktop Community v. 2.0.0.3

EDIT: Adressing the comments:

Local debugging works. The file (index.js) that I am trying to run consists only of console.log('Hello world!') so I don't spawn any child processes on my own. My host system has Windows 10 Pro as OS, so for checking the open ports on host system I used netstat -an | find "55578", which returned nothing. Moreover, if I try to run docker manually from the command line, using docker run -it -p 55578:55578 node, everything runs and no error is given.

Also, each time I try remote debugging, the port number given by Intellij in an error message seems to be random high port number. I tried looking for open ports just after getting error message, but never found one that is open with a number reported by Intellij and those indeed appear in the output:enter image description here

My Run/Debug configuration:

enter image description here

My Docker configuration (I had to check "Expose daemon on tcp://localhost:2375 without TLS" in Docker configuration to make Intellij and Docker play together):

enter image description here

EDIT: When I add --inspect-brk=0.0.0.0:55432 as "Node Parameters" in "Run/Debug Configurations" Intellij windows (per this bug report) the container nad program start, but debugging seems to be no-op (e.g. the program does not stop on breakpoints).

1
Did you try with different port number? - Prakash Krishna
@PrakashKrishna far as I can tell, the port number is chosen by Intellij at random when I click the debug button. Where can I set it? - lukeg
what is a result of netstat | grep 55578? also, does your app spawn child processes? can you debug it locally (using local interpreter)? - lena
@lena I have edited my question and added the details you asked for. - lukeg
please also provide screenshots of your node.js run configuration and docker configuration - lena

1 Answers

1
votes

After updating to Intellij v. 2019.2 I was able to get the container debugging to work using the workaround already mentioned in my question.

I have added a parameter --inspect-brk=0.0.0.0:55432 to Node parameters option in Run/Debug configuration (see the picture below) and everything seems to be working, including the breakpoints. enter image description here