I'm using Apollo Client to send requests to a graphql server. I created a link with apollo-upload-client since I need it for what I'm doing. The client is defined as follows:
const link = createUploadLink({
uri: 'http://localhost:4000/graphql'
});
const client = new ApolloClient({link});
However, when I try to make a mutation, it sends the request to http://localhost:3000/graphql instead. This results in a failed request, as that is not where the server is. Strangely, requests work fine if I specify the uri directly in the client like this:
client = new ApolloClient({uri: 'http://localhost:4000/graphql});
At first I thought it might be a problem with createUploadLink, but even using HttpLink causes this problem. Why does the client request the wrong address when using links?
It turns out the problem was where I was importing ApolloClient from. I was originally importing it from apollo-boost. It worked when I imported it from @apoloo/client.