haraka / Haraka

A fast, highly extensible, and event driven SMTP server
https://haraka.github.io
MIT License
5.08k stars 661 forks source link

Node Inspector Breakpoints ignored #383

Closed ghost closed 10 years ago

ghost commented 10 years ago

I'm trying to develop a plugin and would like to use node inspector in the process. I start the instance like this:

node --debug-brk /usr/local/lib/node_modules/Haraka/bin/haraka -c .

Started like this the the debugger works fine. When I initially start the app from the debugger it starts fine. However it doesn't stop at any breakpoints I set in the plugins. I'm sure that they're executed since I get log messages from within them.

Is this some kind of forced behavior or is it a "bug".

cu Roman

ghost commented 10 years ago

Problem solved, twice.

Root of the problem:

plugins.js doesn't require the script file as such but starts them through a vm object. At current that is done in such a way that the file doesn't work in the node-inspector. Pull Request #390 fixes the issue.

Workaround for versions not fixed:

Instead of selecting the actual script file in your debugger look for an entry that has the same name as your script file but without the .js extension. In my case the file mail_to_couch.js does not work in the debugger while mail_to_couch does the job just fine. The follwing screenshot should explain it:

haraka_node_inspector_solution

Special thanks to _smf_ in the chatoom :)