Not able to Debug https://github.com/graphql/swapi-graphql

Hi,

I need to debug this project to understand the relay and react framework. I tried running this in debug mode but I am getting "Connection refused: connect" error even I fixed the port to be 8800 in main.js file as well in debugger configuration. But when I run in debug mode I see in debugger variable tab that it shows that it is trying to connect to some other port (connecting to localhost:54774) but the main server works fine till that time but once it fails after some time the main server also stops and it is also not reaching any debug point which I have created. Kindly provide your help.  

Thanks,

Yashpal 

6 comments
Comment actions Permalink

hmm... and does the application run normally when not using the debugger? Also, what are you trying to debug - express server, or the client part?

0
Comment actions Permalink

Yes It runs normally but when I try to run it on debug mode it never goes to debugpoint and in debugger variable panel it shows "connecting to localhost:54774" and this port number is random because it keeps changing. Yes I want to dubug the GraphQL and Relay code on the server. Could you please provide some help in this issue. 

Regards,
Yashpal

0
Comment actions Permalink

>when I try to run it on debug mode it never goes to debugpoint and in debugger variable panel it shows "connecting to localhost:54774" and this port number is random because it keeps changing

don't understand what you are talking about. Please provide screenshots of your debug configuration and debugger variable panel

>Yes I want to dubug the GraphQL and Relay code on the server

So, you are trying to debug client-side code? What files did you set breakpoints in?

0
Comment actions Permalink


Hi Elena, Please find the attached screenshot of my debug configuration, main,js file where I have server port defined at 8000 where I have put the breakpoint at line 25 and debugger variable panel showing "connecting to localhost:60239" and kindly let me know if anything else is required and please accept apologies if I have missed out something as I am new to this framework.

Regards,

Yashpal

0
Comment actions Permalink

So, you are trying to debug express server code run as NPM script... To do this, you need modifying your package.json in order to pass the --debug-brk option to the started Node process. See what's written in console when you start NPM run configuration in debug mode:

To debug "start" script, make sure %NODE_DEBUG_OPTION% string is specified as the first argument for node command you'd like to debug.
For example:
 { "start": "node %NODE_DEBUG_OPTION% server.js" }

 

Once I modify the package.json accordingly, I'm able to hit brewakpoints in main.js. Note that there is no 'debug' script in package.json I have downloaded, I've modified the 'start' script:

"start": "npm run download && babel-node %NODE_DEBUG_OPTION% src/cloud/main.js",

 

0
Comment actions Permalink

Thanks a million Elena, finally I am able to debug the code with your guidance.:)

 

Kind Regards,
Yashpal

0

Please sign in to leave a comment.