question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

In role-based schemas, if graphql query fails, return null or errors in addition to the payload

See original GitHub issue

Let’s say a graphql request is made:

query {
  profile { id name age }
}

and age is not in the schema (or the role-based schema).

It is desirable in most situations to still receive the response for id & name along with an additional errors object adjacent to the data that is sent in the response. This is a behaviour desired only if these columns are used in the selection-set and not in the arguments. Currently the response is that graphql query validation failed entirely.

(via ben/cherre and matt/dsi)

@0x777 @dsandip this needs quick triaging. @0x777 comments?

Incidentally, @shahidhk, this is the behaviour with the github graphql api too right?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
0x777commented, Aug 7, 2019

This can only be done if we abandon our current role based schemas (which I think is a bad idea) so I’m closing this.

1reaction
shahidhkcommented, Sep 19, 2018

I guess what the GitHub API does is that permissions are checked on the execution phase rather than in the validation phase like us.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error handling - Apollo GraphQL Docs
A client sent the hash of a query string to execute via automatic persisted queries, but the server has disabled APQ. OPERATION_RESOLUTION_FAILURE. The...
Read more >
GraphQL mutation errors (union errors with interface aka 6a ...
This article tries to show the concrete implementation of stage 6a mutation error handling from Marc-Andre Giroux Guide to graphql errors ...
Read more >
A Guide to GraphQL Errors
One annoying part of just adding error fields to the mutation payload is that we allow for some impossible states in theory. In...
Read more >
Why does a GraphQL query return null? - Stack Overflow
If a Promise rejects, that field will return null and the appropriate error will be added to the errors array in the response....
Read more >
Sub fields returning null · Issue #31 · miragejs/graphql - GitHub
Having an issue returning sub fields.. Not sure If there is something I need to add to resolvers, but have attempted that as...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found