Reputation: 18242
I'm trying to debug an application that has a go backend and a node.js front-end. I run the backend with just a simple bra run
, which emits:
NFO[12-08|11:57:59] Initializing HTTP Server logger=http.server address=0.0.0.0:3000 protocol=http subUrl= socket=
I then try to run a debugging session in WebStorm, with the following npm configuration:
This outputs the following when I start the debugging session:
/usr/local/bin/node --inspect-brk /usr/local/lib/node_modules/npm/bin/npm-cli.js run watch --scripts-prepend-node-path=auto
To debug the "watch" script, make sure the $NODE_DEBUG_OPTION string is specified as the first argument for the node command you'd like to debug.
For example:
"scripts": {
"start": "node $NODE_DEBUG_OPTION server.js"
}
Debugger listening on ws://127.0.0.1:9229/7c6f9f1b-377e-4a07-b7f8-0155b0d59adb
For help see https://nodejs.org/en/docs/inspector
Debugger attached.
So I'm pretty new to debugging web apps in general, but I expected that I could now just open my browser to localhost:3000/my/script.js
and have breakpoints in WebStorm get hit. This isn't the case though; I can navigate my application just fine (even with just the bra run
command and the debugging session not active in WebStorm), but it doesn't trigger any breakpoints in WebStorm. I'm also not entirely sure what the ws://128.0.0.1:9229
endpoint is for, but I assume it has something to do with why I can't get anything to work.
I've been struggling with this for hours and am pretty stuck on how to get the application to run so that I can use WebStorm to debug it.
Upvotes: 1
Views: 677
Reputation: 93728
With this configuration, you are debugging the watch
npm script, not the application served by grafana. To debug the application, you should have created a JavaScript debug run configuration, specifying localhost:3000
as URL.
See https://www.jetbrains.com/help/webstorm/2017.3/debugging-javascript-in-chrome.html, Debugging an application running on an external web server
Upvotes: 2