Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remotely debugging my node app that is hosted on AWS

I would like to connect to my node server running in debug mode on AWS (node --debug app.js) from my development machine, and be able to debug my app remotely.

Two questions:

  • Can I do this with node-inspector? I wish I could, but node-inspector fails to install on my AWS instance.

  • Any alternatives that will allow me to do this?

like image 306
appa Avatar asked Jan 11 '14 01:01

appa


People also ask

How do I use remote debugging?

Select Configure remote debugging to configure the firewall and start the remote debugger. When configuration is complete, the Remote Debugger window appears. The remote debugger is now waiting for a connection. Use the server name and port number shown to set the remote connection configuration in Visual Studio.

What is remote debugging?

In simple terms, remote debugging is debugging an application that runs in a place other than your local environment. This is usually done by connecting the remotely running application with your development environment.


2 Answers

And with the help of tepez's answer, the following worked for me (Node Inspector v0.12.2):

On my machine:

ssh -L 8080:127.0.0.1:8080 <username>@<host> -N 

On the remote server:

node-debug --cli <appname> 

And enter the following address in the browser:

127.0.0.1:8080/?ws=127.0.0.1:8080&port=5858 
like image 79
R. Itzi Avatar answered Sep 19 '22 21:09

R. Itzi


Forward remote debugger port with ssh from your dev machine

ssh -L 5858:127.0.0.1:5858 [email protected]

And now you can start node-inspector as if the debugger is running locally.

like image 29
Andrey Sidorov Avatar answered Sep 18 '22 21:09

Andrey Sidorov