No breakpoints are hit with Geddy
Asked Answered
P

4

6

Im evaluating the Geddy MVC framework for node.js and I am seeing a strange issue - none of my breakpoints get hit when debugging.

I am using WebStorm to launch node.js in debug mode.

I dont know how to make Geddy start in debug mode using the CLI command so I have a bootstrapper file that I use that looks like this:

console.log("Starting server...")
var geddy = require("geddy/bin/cli")
console.log("Server started.")

I set a breakpoint on all three lines and only the last console.log gets hit, so at least I know that the breakpoints and debugging is working properly.

Geddy internally require()'s my controllers who also have breakpoints set in several locations. These never get hit, but the controllers do work properly and the HTTP requests are served properly as well.

Is there any reason why breakpoints will not be hit in Geddy? Is there something more I can do?

Plenipotent answered 6/3, 2012 at 16:20 Comment(3)
Maybe try adding debugger; to your source, in place of the console.log. (or right before) Does that change anything for you?Porringer
Nope. I think that the issue may be related to the fact that Geddy uses cluster internally which spawns new processes, which the debugger are not connected to. Im trying to confirm this.Plenipotent
I'm experiencing the same... any updates by chance?Hydracid
P
1

I have been unable to verify this, but I believe the issue is due to the fact that cluster spawns new processes but the debugger is unaware of them. I have not found a way to attach the debugger to the new processes, and im not even sure if they can be started with the debugging port open.

Geddy uses cluster so it inherits this issue.

This thread mentions a possible solution: ( How do I enable --debug for node.js when running GeddyJS ) but this did not help me.

Plenipotent answered 16/3, 2012 at 0:39 Comment(0)
T
3

There's a Debugging WikiPage with some information about how to debug geddy.

Triumph answered 16/10, 2012 at 17:47 Comment(0)
P
1

I have been unable to verify this, but I believe the issue is due to the fact that cluster spawns new processes but the debugger is unaware of them. I have not found a way to attach the debugger to the new processes, and im not even sure if they can be started with the debugging port open.

Geddy uses cluster so it inherits this issue.

This thread mentions a possible solution: ( How do I enable --debug for node.js when running GeddyJS ) but this did not help me.

Plenipotent answered 16/3, 2012 at 0:39 Comment(0)
T
1

Geddy doesn't currently support debugging, but we'd love to add that as a feature.

Treenatreenail answered 19/4, 2012 at 23:13 Comment(1)
This answer is now obsolete, check out @miguel's answer above.Treenatreenail
E
1

To answer the question specifically for Jetbrains WebStorm or IntelliJ (with the Node.js plugin) debugging:

In short, set up your app as if you were going to deploy on Heroku or Nodejitsu.

package.json

{
  "name": "geddy_todo",
  "version": "0.0.1",
  "dependencies": {
    "geddy": "0.6.x"
  },
  "engines": {
    "node": "0.8.x",
    "npm": "1.1.x"
  }
}

Next you have two options

Option 1. Create an app.js that runs geddy.

app.js

var geddy = require('geddy');

geddy.start({
  environment: process.env.GEDDY_ENVIRONMENT || 'production'
});

In WebStorm/IntelliJ, in your Run/Debug Configuration for the Node.js app be sure to add an the environment variable GEDDY_ENVIRONMENT and set it to 'development' or 'test' if you want to run your tests.

Option 2 Invoke the geddy client directly

@MiguelMadero mentioned this idea in the comments. Set you WS/IJ to run the following

path/to/geddy/bin/cli.js 
Emmaemmalee answered 6/1, 2013 at 5:41 Comment(1)
There's no need to do this, simple instead of running geddy to start you run node path/to/geddy/bin/cli.js and set the usual debug flags.Triumph

© 2022 - 2024 — McMap. All rights reserved.