Skip to content

GraphQL Stack Traces are (Needlessly) Unhelpful; #2215

@machineghost

Description

@machineghost

Here is a stack trace I recently got:

 Error: Cannot return null for non-nullable field User.id.
    at completeValue (/home/me/projects/my-project/server/node_modules/graphql/execution/execute.js:560:13)
    at completeValueCatchingError (/home/me/projects/my-project/server/node_modules/graphql/execution/execute.js:495:19)
    at resolveField (/home/me/projects/my-project/server/node_modules/graphql/execution/execute.js:435:10)
    at executeFields (/home/me/projects/my-project/server/node_modules/graphql/execution/execute.js:275:18)
    at collectAndExecuteSubfields (/home/me/projects/my-project/server/node_modules/graphql/execution/execute.js:713:10)
    at completeObjectValue (/home/me/projects/my-project/server/node_modules/graphql/execution/execute.js:703:10)
    at completeValue (/home/me/projects/my-project/server/node_modules/graphql/execution/execute.js:591:12)
    at completeValueCatchingError (/home/me/projects/my-project/server/node_modules/graphql/execution/execute.js:495:19)
    at resolveField (/home/me/projects/my-project/server/node_modules/graphql/execution/execute.js:435:10)
    at executeFields (/home/me/projects/my-project/server/node_modules/graphql/execution/execute.js:275:18)
    at collectAndExecuteSubfields (/home/me/projects/my-project/server/node_modules/graphql/execution/execute.js:713:10)
    at completeObjectValue (/home/me/projects/my-project/server/node_modules/graphql/execution/execute.js:703:10)
    at completeValue (/home/me/projects/my-project/server/node_modules/graphql/execution/execute.js:591:12)
    at /home/me/projects/my-project/server/node_modules/graphql/execution/execute.js:492:16

The problem is, it's entirely made up of lines from graphql, which means it's entirely worthless for helping me understand where the error occurred (ie. the entire thing stack traces are supposed to do). All I know is that it involved a resolver which somehow involved a User ID.

I don't mean to sound ungrateful for awesome free software (that is the best way to build an API today) ... and I very much am appreciative of all the hard work that has gone into this project ... but would it kill you to at least include the query and variables used in the stack trace?

At the moment it really feels like the library is saying "Oh you messed up? Well, too bad: you're on your own now chump! That's you what you get for making a mistake." ;) But surely you want to help users understand errors, no? And surely GraphQL has the query/variables available to include in the error, since it receives both long before the error occurs?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions