In my local machine, I can debug my Node.js app with Chrome DevTools.
Since using goormIDE I have no idea how to debug it in the same way.
Is there a way to do that?
In goormIDE, run your Node.js app with option --inspect=0.0.0.0:9229
For example, node --inspect=0.0.0.0:9229 app.js
0.0.0.0 is to allow the connection from DevTools, which is outside of the goormIDE container.
And 9229 is to specify the port that will be using.
Open menu CONTAINER - Port Forwarding Configuration and register a port 9229
Click the copy button at the Command column, then the IP:port value will be copied.
In Chrome, open a new tab and go to chrome://inspect
Enable Discover network targets option and click Configure... at the right.
Paste the IP:port value you copied at step 3, and press Enter then click Done.
Then you may see your app is listed at Remote Target and ready to be inspected.
Related
I keep having this issue where Mocha opens multiple debuggers when I run mocha --inspect-brk. Even though Chrome easily attaches its Node inspector to the first debugger process, it never attaches to the second process that Mocha starts up and Mocha just hangs forever.
How do I get Chrome to continue to attach inspectors to all the processes that Mocha starts up?
For example, I run mocha --inspect-brk and get the following output printed to my terminal:
Debugger listening on ws://127.0.0.1:9229/xxxx
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
Debugger listening on ws://127.0.0.1:43210/xxxx
While Chrome attaches easily to 127.0.0.1:9229 (which you can see in the logs above with Debugger attached), it does not attach to 127.0.0.1:43210.
This happens when Mocha opens processes with debuggers that use ports which Chrome's Node inspector does not know about yet. In the example, 43210 is the port which Chrome isn't trying to attach debuggers to.
Here's how to solve this:
run mocha --inspect-brk
copy the host of websocket URL that never gets a debugger attached to it (in the given example, this would be 127.0.0.1:43210)
open Chrome
go to chrome://inspect/#devices in Chrome
click Open dedicated DevTools for Node
open the Connection tab (next to the Console tab) in the new window that pops up
click Add connection
paste in the copied host name (from step 2) to Chrome for the new connection
Now Chrome will connect an inspector to the new process! If any other port numbers are used in subsequent processes that Chrome doesn't connect to, simply add those to Chrome's Node inspection connection list as well.
I am trying to follow this tutorial.
At 55:39 Ania is able to connect to her localhost:8888/.netlify port to see the records she has read from the graphql playground.
I am trying to do the same but cannot connect to the page. I have tried in both chrome and firefox and in both cases, I get a connection refused error message.
My firewall has permitted access for both chrome and firefox, and I even tried disabling the firewall. The error still returns.
I tried it without my vpn turned on.
I have logged into netlify (I have nothing on github yet, so it's just a local deployment).
Is there something special I need to do to be able to run local host with netlify?
The full text of the error message is:
This site can’t be reachedlocalhost refused to connect. Try:
Checking the connection Checking the proxy and the firewall
ERR_CONNECTION_REFUSED Check your Internet connection Check any cables
and reboot any routers, modems or other network devices you may be
using. Allow Chrome to access the network in your firewall or
antivirus settings. If it is already listed as a program allowed to
access the network, try removing it from the list and adding it again.
If you use a proxy server… Check your proxy settings or contact your
network administrator to make sure that the proxy server is working.
If you don't believe you should be using a proxy server: Go to
Applications > System Preferences > Network > Advanced > Proxies and
deselect any proxies that have been selected.
In relation to #1, I am connected to the internet. I can run the local host on port 3000 and get the react app to load. it does not read anything from graphql. When I console log the datastax data from the react app, I get null as a result (where Ania gets the records created in the first hour of the tutorial).
In relation to #2, chrome and firefox are both added to my firewall
In relation to #3, no proxies are used - except the box to use FTP Mode PASV is checked. I tried unchecking it but it makes no difference.
I tried adding the local host 8888 url as a Bypass proxy settings for these Hosts & Domains in my system preferences - but it makes no difference.
My console shows:
◈ Netlify Dev ◈ ◈ Ignored general context env var: LANG (defined in
process) ◈ Injected .env file env var: ASTRA_GRAPHQL_ENDPOINT ◈
Injected .env file env var: ASTRA_DB_APPLICATION_TOKEN ◈ Loaded
function getGenres
http://localhost:8888/.netlify/functions/getGenres. ◈ Functions server
is listening on 55302 ◈ Starting Netlify Dev with Create React App $
react-scripts start (node:55384)
[DEP_WEBPACK_DEV_SERVER_ON_AFTER_SETUP_MIDDLEWARE] DeprecationWarning:
'onAfterSetupMiddleware' option is deprecated. Please use the
'setupMiddlewares' option. (Use node --trace-deprecation ... to show
where the warning was created) (node:55384)
[DEP_WEBPACK_DEV_SERVER_ON_BEFORE_SETUP_MIDDLEWARE]
DeprecationWarning: 'onBeforeSetupMiddleware' option is deprecated.
Please use the 'setupMiddlewares' option. Starting the development
server...
Compiled successfully!
You can now view nextflix-datastax-clone in the browser.
Local: http://localhost:3000 On Your Network:
http://10.0.0.1:3000
Note that the development build is not optimized. To create a
production build, use yarn build.
webpack compiled successfully
ONE CLUE: I have cleaned my mac, I have cleared my cache (don't know why this would have worked since localhost 3000 loads the react app, but without the datastax data). A little box appears on my mac that says 'verifying AID.dylib'. I understand dylib means a shared database (maybe this some sort of Datastax reference? The process has been running almost 48 hours and the progress bar is at about 10%. Whatever that program is, it hasn't been verified. I wonder if this is why I can't load localhost:8888/.netifly in the same way that Ania can?
ANOTHER CLUE: I just found this post: https://github.com/netlify/cli/issues/3617 which suggests that Netlify can't read functions in v17. I don't know if that's still current. I'm currently stuck in my efforts to check if this is the source of the problem because my brew commands wont run in my terminal. I think this may be because of some incompatibility with the macOS Monteray upgrade that I just installed. I will update this post if I find a way to configure my computer to be able to follow a basic beginner's tutorial.
I am trying to setup the firewall for accessing node inspect using my local chrome browser.
Does anybody have a good short guide and which tcp protocol do I need to enable.
I have a firewall rule active where the compute instance enables tcp:80. It worked in the past of a http server. How do I know which port to use for node inspect and how to enable it.
If found it myself. I have to use an ssh tunnel. https://nodejs.org/en/docs/guides/debugging-getting-started/#enabling-remote-debugging-scenarios
Enabling remote debugging scenarios
We recommend that you never have the debugger listen on a public IP address. If you need to allow remote debugging connections we
recommend the use of ssh tunnels instead. We provide the following
example for illustrative purposes only. Please understand the security
risk of allowing remote access to a privileged service before
proceeding.
Let's say you are running Node on remote machine, remote.example.com, that you want to be able to debug. On that
machine, you should start the node process with the inspector
listening only to localhost (the default).
$ node --inspect server.js
Now, on your local machine from where you want to initiate a debug client connection, you can setup an ssh tunnel:
$ ssh -L 9221:localhost:9229 user#remote.example.com
This starts a ssh tunnel session where a connection to port 9221 on your local machine will be forwarded to port 9229 on
remote.example.com. You can now attach a debugger such as Chrome
DevTools or Visual Studio Code to localhost:9221, which should be able
to debug as if the Node.js application was running locally.
I am trying to debug a project which needed a mapping in the hosts files from localhost to some other address like this
127.0.0.1 devproject.com
I can access the web app fine with a port number like this: devproject.com:3000 however this settings doesn't work when I try to debug in WebStorm?
Is there a way to tell WebStorm about this hosts file settings? Or I need to use a whole new settings? I am using node.js debug profile.
When debugging, you need using same URL as you normally use to access your application; so, to start debugging, you just need to specify http://devproject.com:3000 as URL in JavaScript Debug Run configuration. See https://confluence.jetbrains.com/display/WI/Starting+a+JavaScript+debug+session#StartingaJavaScriptdebugsession-Startingadebugsessionwhenusingadifferentwebserver
I am running a Nodejs server with an application which I want to debug.
In order to achieve this using node-inspector I run the app as follows:
node-debug server.js
Unfortunately I can not access the webserver via URL anymore. Visiting http://127.0.0.1:8080 results in
Cannot GET /
However if I start the application the usual way with
node server.js
everything is fine (except for the fact that I can not debug). But I can access http://127.0.0.1:8080.
The '/' request is also not logged so it seems that it never reaches the server.
Hence the problem I have is: I can access the remote debugger via http://127.0.0.1:8080/debug?ws=127.0.0.1:8080&port=5858 but I can not start debugging because I can not trigger any action on the webserver via URL.
Oh and the debugger is not paused or anything. I skipped the first break point.
I resolved the problem by choosing a different port than 8080. It seems like the debugger uses this port. I was not aware of that because this port was familiar to me as I used it for my application.
As Schnodderbalken already answered, the problem lies in the application and inspector both using the same port 8080. If you tell inspector to use a different web port, 8082 for instance, the problem is solved.
You can do this by adding a parameter like so:
node-inspector --web-port=8082
You can then access inspector via http://127.0.0.1:8082/?port=5858