We should modify all the integrations to add a debug argument to the options, which will default to process.env.NODE_ENV === 'production'. If debug is true, the stack trace of all errors should be logged to console.error just before sending the response to the client. In order to do so, we should add a printStackTraces function which gets called like so: graphqlResponse.errors.map(printStackTraces).
This would be a great small PR for someone looking to make their first contribution to apollo-server. Let me know if you're interested!
@helfer I'd like to hop in and help on the debug !
I'd like to help, but I need get familiar with the code first since this would be my first contribution!
the stack trace of all errors should be logged to console.error just before sending the response to the client.
Do you envision this being implemented as a default formatError function, @helfer? Or as a separate layer that grabs the error before it's formatted?
Initially I thought it could be in the formatError function, but I think it's cleaner to keep it separate.
@beardedpayton Awesome! I think the best first step would be to implement this according to the instructions for the express integration, and make a PR against the debug-mode branch. Do you think you're all set, or would it help if I provide more detailed instructions?
@alawi Thanks a lot for volunteering! It looks like @beardedpayton was a bit faster this time, but if you're interested in contributing, #112 would be a great PR to get started with. What do you think?
@helfer it would for sure help with more detailed instructions on writing the initial code. I get exactly what I'm suppose to make happen, it's just going about it. I'm a front-end guy, with html5/css3/jQuery mastered. But I'm in the midst of fine tuning my JavaScript skills... I'll start off by forking and cloning down, then go from there :)
Ok, great! Basically the steps would be as follows:
debug option of type boolean to runQuery. The option should default to false.Error.stack) to console.error right before this line: https://github.com/apollostack/apollo-server/blob/master/src/core/runQuery.ts#L105debug is true, but not if it's false or not provided. (let me know if you need help for figuring out how to do this)At this point, you should make a PR against the debug-mode branch.
After that, we'll have to add the debug option to ApolloOptions, make it default to NODE_ENV === 'production' and then pass it into runQuery for each of the four integrations (express, connect, HAPI, Koa), and write tests for it in integrations.test.ts:
debug argument of type boolean to ApolloOptions (in ApolloOptions.ts)process.env.NODE_ENV === 'production' if it's not set. You can add the code after this line here: https://github.com/apollostack/apollo-server/blob/d588b6993259cb0e1804286d03d0fe32367c38ab/src/integrations/expressApollo.ts#L46Okay, that's quite a lot of stuff now. I think it's best if you just do it step by step and let me know how it goes, or ask questions if something is not clear or not working.
@helfer Okay so I've just got started. Node.js installed, apollo-server and typings installed. I'm in runQuery.ts
I'm a little confused on how to view the live work of apollo ?
Also on step three, am I just setting debug: false; in a code block
then printing console.error(Error.stack); above the line of code you provided
Or more of something along the lines of an if statement.
if (runQuery.debug === false) {
console.error(Error.stack);
}
This is all new to me in this setup, but I'd love to get started and participate!
Thanks for the patience.
@beardedpayton if you want to come by the office anytime next week, I can help you out with some bugs in person too!
I'm a little confused on how to view the live work of apollo ?
I'm not sure what you mean by this. Can you clarify?
For step 3, you should add the option to ApolloOptions and specify it to be false by default with debug = false, so it gets passed to all integrations in the same way.
And then at the place I pointed to, you do something like:
if( options.debug){
graphqlResult.errors.forEach( (e) => console.error(e.stack));
}
@beardedpayton how are things going with this? If you're stuck on anything, feel free to ask! :)
@helfer @stubailo @beardedpayton I am going to start on this today and try to have a PR by the end of the day. Love seeing other people help out I am just trying to push hard today to get all the 0.3 issues resolved and prepared for a new release. Let me know if you would rather me hold off.
Sounds good.
@beardedpayton have you started on this, or is it fine if @nnance does it? If you haven't done too much work on it yet, we can always get you started on another issue. If you're on this but just need a few more days, then let me know and we'll take it out of the 0.3 milestone.
Hey! Sorry for the late reply. I've started but I'm not too deep. He can go ahead and knock it out!
Sent using CloudMagic Email [https://cloudmagic.com/k/d/mailapp?ct=pi&cv=7.6.23&pv=8.3&source=email_footer_2]
On Sat, Sep 10, 2016 at 6:23 PM, Jonas Helfer [email protected] wrote:
@beardedpayton [https://github.com/beardedpayton] have you started on this, or is it fine if @nnance [https://github.com/nnance] does it? If you haven't done too much work on it yet, we can always get you started on another issue. If you're on this but just need a few more days, then let me know and we'll take it out of the 0.3 milestone.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub [https://github.com/apollostack/apollo-server/issues/111#issuecomment-246147420] , or mute the thread [https://github.com/notifications/unsubscribe-auth/ATk3NOeZ2r6sM2ZTKJLLMHGKOqfBnLEXks5qoy3NgaJpZM4JuzV6] .
@beardedpayton Okay, thanks! Would you be interested in doing #112 instead? That issue has a very limited scope, so it should be quick to turn around, and a good PR to start with. :)
Most helpful comment
@helfer I'd like to hop in and help on the debug !