apollographql / apollographql/graphql-subscriptions
Apollo Subscription Issue with Nginx
- Dominant language
- TypeScript
- Stars
- 1.6k
- Forks
- 129
- PR merge metrics
- No merged PRs in 30d
Description
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
Contributor guide
Research direction
Start with the default Apollo subscription example in the issue, then compare its local behavior with the production Nginx configuration and WebSocket network-tab evidence linked in the report. Reproduce the subscription error on the DigitalOcean Ubuntu server and verify that the production subscription resolver returns an Async Iterable and subscriptions work alongside queries and mutations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, nginx, node.js, typescript
- Domain
- api, backend, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100