nestjs / graphql

GraphQL (TypeScript) module for Nest framework (node.js) 🍷
https://docs.nestjs.com/graphql/quick-start
MIT License
1.46k stars 396 forks source link

Subscription field must return Async Iterable. Received: undefined #663

Closed igrek8 closed 4 years ago

igrek8 commented 4 years ago

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
igrek8 commented 4 years ago

https://github.com/nestjs/graphql/issues/251

igrek8 commented 4 years ago

https://github.com/nestjs/graphql/issues/438

jeanfortheweb commented 4 years ago

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

igrek8 commented 4 years ago

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.

kamilmysliwiec commented 4 years ago

Fixed in 7.0.4. Thanks for reporting & PR!

lock[bot] commented 4 years ago

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.