Search code examples
react-nativeexpoapolloreact-apollo

Expo does not create Websocket ApolloClient instance when started with expo start


I use the react-apollo boilerplate in my expo project.

So far the project runs fine. But when I have interactions with my database it fails with:

Unhandled Rejection (Error): Network error: Response not successful: Received status code 400

and

The development server has disconnected.

and

XHR error

So what is the best way to continue? This is the ApolloClient that needs to be running for the connection with my database:

const client = new ApolloClient({
  link,
  cache: new InMemoryCache(),
})

Before I switched to expo I simply run react-scripts start and the database and code were up and running. But now with expo it only starts the code.

Is there something special to expo to also have the database up and running?

There is also no difference between Android and web: enter image description here

Or do I need to outsource that Client and run it there in a new instance? But this has side effects like I cannot access things like state anymore. So this is not really sensefull right?

Found those integrations into the App function but they did not work for me:


Solution

  • Actually it helped to restart the GraphQL server once again via yarn start.

    It not, try to rebuild all modules after cleaning.