Graphql-js: Improve error for "Subscription field must return Async Iterable. Received: undefined"

Created on 31 Jul 2018  路  2Comments  路  Source: graphql/graphql-js

The error thrown "Subscription field must return Async Iterable. Received: undefined" should include where in the schema it called the subscription field and it returned undefined.

enhancement help wanted

Most helpful comment

I had a slight misunderstanding about how subscriptions work so the solution is probably slightly different:
In my case I didn't provide a subscribe method on the field. So the error should actually complain that the subscribe method is missing and not that it returned undefined.

In either case, it should include the field name.

All 2 comments

I had a slight misunderstanding about how subscriptions work so the solution is probably slightly different:
In my case I didn't provide a subscribe method on the field. So the error should actually complain that the subscribe method is missing and not that it returned undefined.

In either case, it should include the field name.

For anyone else here, i got this message from a typo in my "subscribe: () => {asyncIterator}"

I had subscibe *rolls eyes

Was this page helpful?
0 / 5 - 0 ratings