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

For subscriptions, router should auto re-connect after subgraph server restarts #972

Open
agufagit opened this issue Jul 28, 2024 · 3 comments
Labels
bug Something isn't working internally-reviewed The issue has been reviewed internally.

Comments

@agufagit
Copy link

Component(s)

router

Component version

v0.98.2

wgc version

v0.58.5

controlplane version

n/a

router version

v0.98.2

What happened?

Description

For subscriptions, router doesn't auto re-connect when subgraph server restarts

Steps to Reproduce

  1. open a websocket connection to router, make a subscription call, router will open a new websocket connection to subscription subgraph server
  2. restart subscription subgraph server

Expected Result

  1. router auto re-connects to subscription subgraph server, open a new websocket connection and remake that subscription call

Actual Result

  1. the websocket connection between router and subscription subgraph server is gone

Environment information

Environment

OS: Ubuntu 20.04
Package Manager: pnpm
Compiler: go 1.22

Router configuration

dev_mode: true
listen_addr: 0.0.0.0:3009
router_config_path: config_dev.json
authentication:
  providers:
    - name: Auth Provider
      jwks: # JWKS provider configuration
        url: http://auth-gateway:8085/.well-known/jwks.json
        header_names: [Authorization]
        header_value_prefixes: [Bearer]
        refresh_interval: 2h
authorization:
  require_authentication: true
websocket:
  absinthe_protocol:
    enabled: false
file_upload:
  enabled: true
  max_file_size: 50MB
  max_files: 2
graph:
  # Result of `wgc router token create`. Can be omitted for local testing.
  token: ""

Router execution config

I'm testing locally.  I'm using custom modules, so I'm building router image locally.  Custom module code just maps JWT claims information to headers of subgraph requests

Log output

No response

Additional context

No response

@agufagit agufagit added the bug Something isn't working label Jul 28, 2024
Copy link

WunderGraph commits fully to Open Source and we want to make sure that we can help you as fast as possible.
The roadmap is driven by our customers and we have to prioritize issues that are important to them.
You can influence the priority by becoming a customer. Please contact us here.

@StarpTech
Copy link
Contributor

Hi @agufagit thank you for the report. We will take a look and come back.

@StarpTech StarpTech added the internally-reviewed The issue has been reviewed internally. label Jul 30, 2024
@warrenisarobot
Copy link

warrenisarobot commented Nov 19, 2024

@StarpTech I am running in to this issue as well.

The router solution we are currently using is using graphql-tools. This will, transparently to the client, reconnect webosckets if a subgraph goes down.

Cosmo on graphql-transport-ws seems to currently be sending a complete for a subscription if its corresponding subgraph goes down. The client is unable to tell if this is because there is no more data or if this is because the subgraph went down and it should re-subscribe.

If the router reconnects to the subgraph and resubscribes for the client this assists with that, or if it sends an error then the client can at least determine that it should re-subscribe and rebuilt state if necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working internally-reviewed The issue has been reviewed internally.
Projects
None yet
Development

No branches or pull requests

3 participants