apollo-server: Print stack trace of graphql errors when debugging
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!
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 4
- Comments: 16 (11 by maintainers)
Commits related to this issue
- chore(deps): update dependency @types/node-fetch to v2.3.4 (#111) — committed to apollographql/apollo-server by renovate[bot] 5 years ago
- chore(deps): update dependency @types/node-fetch to v2.3.4 (#111) — committed to apollographql/apollo-server by renovate[bot] 5 years ago
@helfer I’d like to hop in and help on the debug !
@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.