Graphql: Subscription field must return Async Iterable. Received: undefined

Created on 15 Mar 2020  路  6Comments  路  Source: nestjs/graphql

Bug Report

Forked nest-typescript-starter. Tried example nest/sample/23-graphql-code-first

Go http://127.0.0.1:3000/graphql and subscribe:

subscription {
  recipeAdded {
    id
  }
}

API returns:

{
  "error": {
    "message": "Subscription field must return Async Iterable. Received: undefined"
  }
}

Potential cause

https://github.com/nestjs/graphql/pull/250/commits/67229099709d6753bc59cc16229ca015834bd420

Expected behavior

Subscription should work

Environment

Nest version: 7.0.0

For Tooling issues:
- Node version: v12.10.0
- Platform:  Mac

Others:
Yarn: 1.21.1

Most helpful comment

Fixed in 7.0.4. Thanks for reporting & PR!

All 6 comments

Same for me. The old issues do not help at all, unfortunately.
The subscription resolver is not even called.

Should fix https://github.com/nestjs/graphql/pull/667. It seems subscribe() the method of @Subscription decorator is not copied to the final resolvers object.

Fixed in 7.0.4. Thanks for reporting & PR!

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings