I'm running express app on remote server (my-domain.com) like that:
node --inspect=0.0.0.0:9229 ./server.js
In intellij idea i've setup debug configuration (Attach Node.js/chrome):
host: my-domain.com
port: 9229
When i click debug button, i get this error:
Invalid response from the remote host. Please check the options in the
debug configuration
I can debug the same application on localhost with this setup:
host: localhost
port: 9229
Why i can't attach to remote node application and debug it? Can intellij idea give me more information about error?
I found cool way that solves my problem and many others, it has been there for ages and i din't use it! :)
For my particular problem it's possible to use ssh tunnels
ssh -L 9221:localhost:9229 user#my-domain.com
Now i can attach node debugger to localhost:9221. It just forwards all traffic from remote port 9229 to my local 9221.
Another this is remote port forwarding:
Just added this line in /etc/ssh/sshd_config:
GatewayPorts yes
Here is
ssh -R 9001:localhost:9000 user#my-domain.com
Now all traffic on port 9000 on remote machine sent to my local node express application. I can debug, do whatever i want
Here's the article i got ideas from: https://blog.trackets.com/2014/05/17/ssh-tunnel-local-and-remote-port-forwarding-explained-with-examples.html
Related
I have installed Apache Superset on a remote Linux Server and initialized it on port 8080. When I pull up localhost:8080 on the Linux server, the homepage shows up which suggests that the installation worked as per their instructions here.
When I try to access this page from my laptop (Windows- Browser:Chrome) with http://server-name:8080. It gives me the 'This site can't be reached' page.
I tested using netcat if the connection was open by typing nc -zvw3 server-name 8080 and it gave me Connection to server-name 8080 port [tcp/webcache] succeeded!
I have Jupyter installed on the same server on port 8888 and it works perfectly. Any thoughts would be greatly appreciated.
You may need to try this command by defining the IP address:
superset run -h 0.0.0.0 -p 8080
Unable to remote debug a node server running on a Vagrant box in Chrome from my host machine. The server is configured to run on port 8123.
Node Version: 7.10.0
In Vagrantfile:
config.vm.network :forwarded_port, host: 9229, guest: 9229
config.vm.network :forwarded_port, host: 8123, guest: 8123
From my vagrant box I run:
$ node --inspect index.js
Debugger listening on port 9229.
Warning: This is an experimental feature and could change at any time.
To start debugging, open the following URL in Chrome:
chrome-devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=127.0.0.1:9229/84085f07-dc42-4e1e-bdd8-532e6dc5c4c6
--- Customer Service---
Connecting to customer repository...
Connected. Starting server...
Server started successfully, running on port 8123.
When I try to access the url in Chrome from my host machine while I don't get an error the sources tab is empty.
Screenshot of devTools
Based on NodeJS 11591 issue. You can't access the Vagrant stuff via localhost (127.0.0.1), so you need to to specify host explicitly:
$ node --inspect=0.0.0.0:9229 index.js
Then you need to set up Target discovery settings in the Chrome. Note that 192.168.33.11 from my sample is the static IP address providing an access to the Vargant host from the local host:
Im running my node app with grunt on a DO droplet. I start the server
Running "connect:server" (connect) task
Waiting forever...
Started connect web server on http://localhost:3000
But when I navigate to my dropletIP:3000 I cannot see the app, I get:
This site can’t be reached
mydropletIP refused to connect.
Shouldn't my app be available? I don't have nginx or anything installed.
I was having similar problem but the solution was simple. Change from 'localhost' to '0.0.0.0' i.e
.listen(8080, '0.0.0.0');
And then to test your api just enter your static ip of droplet with port that you have entered i.e droplet-ip:8080
Check the particular port is opened or not ,using following command
sudo ufw status
If any Firewall enabled and any port is block means you can see that.
netstat -an | grep "LISTEN " ( List of listening port on server)
I need this info ,then only we can find a problem
I have WebStorm7 installed on a Windows7 machine.
If I run a meteor project in the Windows7 machine with:
>set NODE_OPTIONS=--debug=47977 & meteor
it prints:
=> Meteor server running on: http://localhost:3000/
=> debugger listening on port 47977
and I can debug with WebStorm7 using the_Node.js Remote debug_ configuration, with Host: 127.0.0.1 and Port: 47977.
If I run a meteor project in a Ubuntu machine (within a Oracle VM VirtualBox, with address 192.168.1.9) with:
$ NODE_OPTIONS="--debug=47977" meteor
it prints only:
=> Meteor server running on: http://localhost:3000/
and I cannot debug with WebStorm from the Windows7 machine using the Node.js Remote debug configuration, with Host: 192.168.1.9 and Port: 47977.
From the ubuntu machine a telnet 127.0.0.1 47977 does not work too. It looks like the debugger is not started at all. What am I doing wrong?
the issue might be related to the fact that node.js debugging is only listening on localhost, so you can't connect to the used port from remote host. The workaround is to use a proxy (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 what 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 Remote Debug run configuration as a debug port
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?
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
Forward remote debugger port with ssh from your dev machine
ssh -L 5858:127.0.0.1:5858 ubuntu#some.ec2.host.com
And now you can start node-inspector as if the debugger is running locally.
Allow me to present an alternative using node --inspect. I had the same need, although in a Windows environment, I believe this should work for you.
Remote machine (tested with Node 6.10.2, Windows Server 2012)
node --inspect=0.0.0.0:9229 <appname>.js
Local Machine (tested with Win 10, Chrome 60.0.3112.90)
In Chrome DevTools - Click the vertical ellipsis menu in top right:
Go to: More Tools -> Remote Devices
Under Network targets Click Add address
Enter <remote-ip>:9229
Once you enter address and remote target is connected you'll see Node.JS Icon on Top Left of DevTools
Click NodeJS Logo to launch DevTools Node Debugger
Screenshots of Steps 1,3,4 below.
One more option to use 0.0.0.0 to listen to request from outside:
node-debug --web-host=0.0.0.0 --cli app.js
and visit this address to debug:
http://<the-domain>:8080/?port=5858
it would be better if HTTP/2 is available since there are lots of small files.
You can use node --inspect too in your remote machine.
Start your node with node --inspect myapp.js
Then locally ssh -L 9229:127.0.0.1:9229 myuser#myserver -N
Search for an string like this at the log head and copy it
chrome-devtools://devtools/remote/serve_file/#60cd6e859b9ff284980/inspector.html?experiments=true&v8only=true&ws=127.0.0.1:9229/bef2ae68
Paste it in your chrome browser
Enjoy :)
If you are using pm2 just add this on your ecosystem.js
"apps": [{
"name": "myapp",
"script": "index.js",
"node_args": ["--inspect"],
...
Also you can specify --web-host argument.
node-inspector --web-host host.amazonaws.com
This is what worked for me:
Start node-inspector on server.
Start debugee on remote server with --debug flag.
Note the port that the debugger listens on, i.e. Debugger listening on port DEBUG_PORT message.
Create an ssh tunnel for port 8080, not the DEBUG_PORT as Andrey Sidorov's answer suggests.
Open SERVER_API:8080/debug?ws=127.0.0.1:8080&port=DEBUG_PORT in browser an voilà.
Node Inspector v0.10.1