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

subscribeToMore disconnects on GraphQL error #877

Closed
tpodom opened this issue Dec 7, 2019 · 1 comment
Closed

subscribeToMore disconnects on GraphQL error #877

tpodom opened this issue Dec 7, 2019 · 1 comment

Comments

@tpodom
Copy link

tpodom commented Dec 7, 2019

Describe the bug
When using subscribeToMore, if one of the resolvers throws an error on the server, the client receives a GraphQL error which initiates a subscription shutdown. I tried adding an onError callback but the Observerable.notifySubscription just unconditionally closes the subscription when an error is received.

I have the reconnect: true option set on the WebSocketLink but the problem is that the subscription ends even though the websocket link is still alive.

Would the best workaround be to not use the subscribeToMore option on the query definition and instead have a method that calls the subscribeToMore and onError re-call that method to re-establish the subscription?

To Reproduce
Steps to reproduce the behavior:

  1. Define a smart query with a subscribeToMore
  2. Publish a message on the server
  3. Throw an error from a resolver on the server
  4. You'll see that the server receives a stop message in the websocket frames
  5. Publish another message on the server
  6. Since the stop message was sent, the new publish is never processed

Expected behavior
I would expect the subscription to either re-connect or stay alive when an exception occurs.

Versions
vue: 2.6.10
vue-apollo: 3.0.0
apollo-client: 2.6.4

Additional context

@Akryum
Copy link
Member

Akryum commented Nov 18, 2021

Likely caused by this line https://github.com/apollographql/subscriptions-transport-ws/blob/a8bbabfe375090b44d4a8bd028356ec53d48a23a/src/client.ts#L645

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants