Skip to content
This repository was archived by the owner on Dec 19, 2023. It is now read-only.
This repository was archived by the owner on Dec 19, 2023. It is now read-only.

Subscription does not handle properly NonNullableFieldWasNullException #378

Closed
@BlasiusSecundus

Description

@BlasiusSecundus

NonNullableFieldWasNullExceptions are apparently not properly handled in case of subscriptions. Take the following schema as an example:

type Foo {
    bar: String!
}

type Query {
    foo: Foo!
}

type Subscription {
    foo: Foo!
}

If Foo.bar is null, the query returns the following specification-compliant response:

{
  "errors": [
    {
      "message": "Cannot return null for non-nullable type: 'String' within parent 'Foo' (/foo/bar)",
      "path": [
        "foo",
        "bar"
      ],
      "extensions": {
        "classification": "DataFetchingException"
      }
    }
  ],
  "data": null
}

However, the subscription only sends the following message to the client:

{"type":"error","id":"1"}

GraphQL Playground displays the following error message:

{
  "error": {
    "name": "FormatedError",
    "message": "Unknown error"
  }
}

Other clients, however, may go into an infinite loading/waiting state, not recognizing that an error occurred.

Tested version: 7.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions