Webstorm debugger for node.js doesn't connect for executed node.js process

I'm try to debug my js code from node.

 

For example, I

  1. make a default node.js project from webstorm templates (express app).
  2. press debug button (or Run -> Debug at top bar)
  3. presetted debugger for that project started
  4. At debugger window I see how node process started and waiting while any debugger connect for it
  5. And that's all. Nothing happens.
  6. But if I use embedded node.js debugger at chrome, it connected to the 62102 port and I see message how debugger connected.

What I'm doing wrong? As I see at guide here: https://www.jetbrains.com/help/webstorm/running-and-debugging-node-js.html, webstorm debugger must automatically connect to node process.

My webstorm data:

WebStorm 2018.1.5
Build #WS-181.5281.31, built on June 14, 2018

JRE: 1.8.0_152-release-1136-b39 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.12.6

8 comments
Comment actions Permalink

Please can you explain what makes you think that the debugger doesn't connect? Lack of `Debugger attached` message? You shouldn't care about it, debugger is attached even though the message is not there.

Did you try setting breakpoints? Also, I'd suggest enabling After launch in Browser/Live Edit tab of your run configuration to the application loaded in browser once the server is started

 

0
Comment actions Permalink

Yes, I'm sure that webstorm debugger is not connected.

When I turn debug at express app example and after that open http://localhost:3000 at my browser, I don't see anything, because node doesn't listen 3000 port, because that started with --inspect-brk param and waiting for debugger. And if i connect to node process with chrome debugger, and start execution everything is ok.

0
Comment actions Permalink

weird... you are using the default configuration that definitely works.

Can you recreate the issue and provide your idea.log (https://intellij-support.jetbrains.com/hc/en-us/articles/207241085-Locating-IDE-log-files) and screencast that shows your steps?

0
Comment actions Permalink

I cannot believe the level of incompetence of JetBrains when it comes to resolving such issue. Do you guys even perform QA? this has been happening to me since and whenever it occurs I just had to restart webstorm and it works again. I cannot believe we fail at replicating this at all.

anyway, here is my reporduction step
1. go to chrome chrome://inspect/#extensions
2. inspect "JetBrains IDE Support"
3. error is "Cannort create item with duplicate id"

This occurs I believe when you try to restart the debug mode with several breakpoints in place early on while also not stopping then clicking the debug but rather just clicking the debug icon while one is already running. This will occur randomly on my end but is the common way of replicating it on this stupid IDE. not worth the money if it takes more than a year for this to fix on their end TBH!

Environment are as follows:

{"name":"WebStorm 2019.1.3","productName":"WebStorm","baselineVersion":191,"buildNumber":"191.7479.14"}

NodeJS Ver: 10.16.0 (but also happens to 8 and 6)

-1
Comment actions Permalink

Are there any updates on this issue? This happens to me pretty often and I don't know what exactly fixes it, I just have to restart almost everything for it to start working. The same steps, simple node.js app, the whole process gets stuck at:

 

Debugger listening on ws://127.0.0.1:61127/3916f003-4f92-4bb3-bc47-16073a377fc6
For help, see: https://nodejs.org/en/docs/inspector
0
Comment actions Permalink

Must be https://youtrack.jetbrains.com/issue/WEB-40496; please try disabling js.debugger.use.node.options key in Registry (Help | Find action, type Registry to locate it) - does it make things any better?

1
Comment actions Permalink

Works for now, will report later on. Thanks for a quick answer, Elena!

0
Comment actions Permalink

I believe, webstorm needs a bit of time (milliseconds), to successfully connect to the running remote debugger host of a running remote application.

Try working with a timeout:
setTimeout(function () {
console.log ('Timeout!'); // Breakpoint here
}, 1000);

Then the webstorm debugger client should (< 1000ms) successfully connect/attach himself to the running remote debugger process, which was started by --inspect.

Otherwise, I have tested --inspect-brk, then "Break before user code starts" makes it possible, to recognize where to break further execution, by your breakpoints.

https://nodejs.org/en/docs/guides/debugging-getting-started/#command-line-options

If nothing of them helps, only the listening remote debugging port could already be in use, or the debugger host address is not reachable by the debugger client of webstorm.

If the debugger host address and port is reachable, and debugging really doesn't work like described here, only a miss configuration of webstorm`s debug configuration (for example no "Reconnect automatically" checked) could be the reason.

Sometimes, obviously/surely by an internal interval for reconnecting from webstorm`s debugger client to the running remote debugger host, it seems, that its only working randomly, if the connection to the debugger host already works, before the remote process executes the script and/or can recognize any breakpoints to break execution.

Thats obviously all about it.

 
 

 

 

0

Please sign in to leave a comment.