juniper
juniper copied to clipboard
panic `resolve() must be implemented by non-object output types` with badly formatted query
Describe the bug
A badly formatted query can result in a panic: resolve() must be implemented by non-object output types.
To Reproduce
Using the API at https://github.com/MHRA/products/tree/4b8712cb9f7b1b15d3f120db8792d4033586343e/medicines/api, I was trying to use the following query:
{
products(searchTerm: "IBUPROFEN") {
edges {
node {
id
}
}
pageInfo
}
}
Note that pageInfo should have stuff underneath it such as hasPreviousPage.
In GraphiQL, this shows:
{
"message": "The network connection was lost."
}
On the server, we see:
thread 'actix-rt:worker:6' panicked at 'resolve() must be implemented by non-object output types', <::std::macros::panic macros>:2:4
Expected behavior
An error message in GraphiQL explaining that the query was badly formatted.
Additional context
I'm quite new to Rust and GraphQL, so apologies that this isn't the greatest bug report of all time. I blogged about this error and was asked to report it here.
Thanks for the bug report! Sounds like this should have been caught in the query validation phase. Does running this to reproduce the bug require anything besides Rust? It would be nice to have a simple way to reproduce it that didn't require lots of dependencies.