Skip to content

panic resolve() must be implemented by non-object output types with badly formatted query #546

Open
@craiga

Description

@craiga

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions