Can't debug a node.js app remotely

Hey everyone,

I'm trying to debug a remote app following these steps. But I can't make it work.

On the server:

  • I use node 6.7.0
  • I use pm2 1.1.3 to run the app
  • Defined --debug=XXXX and the log returns "Debugger listening on [::]:XXXX"
  • I allowed the use of the port XXXX.

In Webstorm 2016.2.3#WS-162.1812.21:

But I keep getting "Connection Failed" error, with no more info. Does anyone know how to do this? What's missing?

1 comment
Comment actions Permalink

did you set up a proxy or port forwarding? Node.js debugging is only listening on localhost. See http://delog.wordpress.com/2011/04/08/a-simple-tcp-proxy-in-node-js/, for example
This proxy can be used as follows:
$: node tcpproxy.js 8585 127.0.0.1 5858
8585 here is the 'exposed' port that Webstorm will connect to (you can make this whatever you wish). You are directing traffic that is coming in on 8585 to 5858 (the local debugging port). Ensure 8585 is open on your firewall if you have one. You have to specify this 'exposed' port in your WebStorm Remote Debug run configuration as a debug port.

See also http://stackoverflow.com/questions/21633924/connecting-webstorm-to-a-remote-node-js-debugging-session

Also, you need to make sure to run your application with `--debug-brk`, not `--debug`

0

Please sign in to leave a comment.