reactioncommerce/reaction-admin

initApollo.js: WebSocket is closed before the connection is established.

quano1 opened this issue · 1 comments

Prerequisites

  • Are you running the latest version?
  • Are you able to consistently reproduce the issue?
  • Did you search the issue queue for existing issue? Search issues

Issue Description

After login as admin. Constantly get this message on admin page: 'WebSocket connection to 'ws://localhost:3000/graphql' failed: WebSocket is closed before the connection is established.'

Steps to Reproduce

Please provide starting context, i.e. logged in as a user, configure a particular payment method.

  1. start all containers
  2. login admin
  3. refresh the page
  4. Observe the issue

Possible Solution

A solution from: hasura/graphql-engine#4509 (comment)

initApollo.js

new WebSocketLink({
      uri: graphQlApiUrlWebSocket,
      options: {
        reconnect: true, // auto-reconnect
        lazy: true, // <--- THIS LINE
        connectionParams: {
          authToken: localStorage.getItem("Meteor.loginToken")
        }
      }
    }),

Versions

3.11.1

j2l commented

Even after fixing initApollo.js I get an empty profile for the admin user.
In console:
WebSocket connection to 'ws://localhost:3000/graphql' failed: WebSocket is closed before the connection is established.