nareshbhatia / graphql-bookstore

Example demonstrating the use of GraphQL to implement a rich domain with multiple entities and relationships
121 stars 18 forks source link

Subscriptions throw an exception on the server #2

Open nareshbhatia opened 5 years ago

nareshbhatia commented 5 years ago

Book creation results in an exception on the server:

Cannot read property 'bookService' of undefined

The underlying reason is that dataSources are not passed to resolvers during pubsub.publish()

Related issues:

  1. https://github.com/apollographql/apollo-server/issues/1526
  2. https://github.com/apollographql/apollo-server/issues/1553

For now, I have worked around this issue by creating a global instance of dataSources instead of passing it via context.

robross0606 commented 5 years ago

When was the last time you checked if this was still an issue?

snwfdhmp commented 4 years ago

@nareshbhatia up

nareshbhatia commented 4 years ago

Don't think there is an update from Apollo on this issue. See the comments on their roadmap, e.g. https://github.com/apollographql/apollo-server/issues/2360#issuecomment-641697135