Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

graphql with subscriptions disconnect #97

Closed
mabc224 opened this issue May 11, 2021 · 5 comments
Closed

graphql with subscriptions disconnect #97

mabc224 opened this issue May 11, 2021 · 5 comments

Comments

@mabc224
Copy link

mabc224 commented May 11, 2021

I am using graphql with subscriptions. There many microservices which are connected with gateway. I am facing below error. My gateway server disconnects when react app page is refreshed and it due to subscription socket.

Context

  • Moleculer version: 0.14.12
  • NodeJS version: 12.18.0
  • Operating System: Ubuntu
  • Other dependencies
    "moleculer-apollo-server": "0.3.3",
    "moleculer-web": "0.10.0-beta1",
    "nats": "1.0.0",

Current Behavior

Server disconnects upon refreshing page.

/app/node_modules/subscriptions-transport-ws/node_modules/ws/lib/websocket.js:757
  websocket.readyState = WebSocket.CLOSING;
                       ^TypeError: Cannot set property 'readyState' of undefined
    at Socket.socketOnClose (/app/node_modules/subscriptions-transport-ws/node_modules/ws/lib/websocket.js:757:24)
    at emitOne (events.js:121:20)
    at Socket.emit (events.js:211:7)
    at TCP._handle.close [as _onclose] (net.js:561:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bananarama-gateway@0.0.1 start: `node bin/runner.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bananarama-gateway@0.0.1 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2021-04-14T17_38_21_963Z-debug.log

Expected Behavior

It should not disconnect.

@AndreMaz
Copy link
Member

Hi @mabc224 Can you create a simple repro repo?

@mabc224
Copy link
Author

mabc224 commented May 11, 2021

Frontend: url
backend: url

graphql playground: url

It is minimal example without nats server. (I am using molecular with NATS)

@AndreMaz
Copy link
Member

What are the steps to reproduce the error?

@mabc224
Copy link
Author

mabc224 commented May 12, 2021

When page is refreshed, Then this error usually happen.

On my staging servers with little to no load, this error happened time to time in an hour.
On my production servers, this error happened frequently under high load.
And when it happened, the server crashed and got restarted by kubernetes intentionally.
And then all the previously connected clients reconnected at once.

@mabc224
Copy link
Author

mabc224 commented Aug 23, 2021

Closing this as It was handled in this issue#51 and PR#91

@mabc224 mabc224 closed this as completed Aug 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants