apollographql / graphql-subscriptions

:newspaper: A small module that implements GraphQL subscriptions for Node.js
MIT License
1.58k stars 133 forks source link

Apollo Subscription Issue with Nginx #233

Open davidkhanpk opened 3 years ago

davidkhanpk commented 3 years ago

I am working with default apollo subscription docs example.

`const { PubSub } = require('graphql-subscriptions'); const pubsub = new PubSub();

newMessage: { subscribe: () => pubsub.asyncIterator([NEW_MESSAGE]), }, `

This code is working just fine on my local server. But on production server i am getting this error Queries and Mutations are working fine on production.

{"type":"error","id":"2","payload":{"message":"Subscription field must return Async Iterable. Received: { pubsub: { ee: [EventEmitter], subscriptions: {}, subIdCounter: 0 }, pullQueue: [], pushQueue: [], running: true, allSubscribed: null, eventsArray: [\"NEW_REACTION\"] }."}}

https://ibb.co/0Qh76vC ( photo url for difference between local and production server ) https://ibb.co/g4LSZsH ( photourl for websocket network tab )

On production running nginx with these configurations https://ibb.co/P6zrfM5

For production running digitalocean ubuntu droplet