Skip to content

500 error for unknown types in variable definitions #1936

@andershagbard

Description

@andershagbard

Describe the bug

It returns 500 server error, if you are sending an unknown type in the orderByDirective.

Expected behavior/Solution

It should send some kind of GraphQL incorrect format response.

Steps to reproduce

  1. Create a query which is using the orderBy directive
  2. Define your query on the client side. E.g.:
query(
  $page: Int!
  $first: Int!
  $orderBy: [UNKNOWN_TYPE!]
) {
  ...
  1. Send query

Output/Logs

Click to expand
[2021-09-15 14:49:55] local.ERROR: Lighthouse failed while trying to load a type: OrdersOrderByOrderByClause

Make sure the type is present in your schema definition.
 {"userId":1,"exception":"[object] (Nuwave\\Lighthouse\\Exceptions\\DefinitionException(code: 0): Lighthouse failed while trying to load a type: UNKNOWN_TYPE

Make sure the type is present in your schema definition.

Lighthouse Version

5.23

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn error within Lighthouse

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions