Apollo: You are calling concat on a terminating link, which will have no effect

I noticed that in the vue-apollo readme there is some docs for the apolloClient configs and it says you can turn off defaultHttpLink to use terminating links.

return {
  link,
  cache: new InMemoryCache()
  defaultHttpLink: false, // this should do the trick
}

The solution for me is putting Http Link at the end of the Apollo Link array (used when you're creating the Apollo Client).

...
const param = {
  link: ApolloLink.from([
    onError(...) =>...,
    authLink...,
    new HttpLink({
      uri: '/graphql',
      credentials: 'same-origin'
    })
  ]),
  cache: ...,
  connectToDevTools: ...
}

new ApolloClient(param);

I'm using these libraries:

  • apollo-client
  • apollo-cache-inmemory
  • apollo-link
  • apollo-link-http
  • apollo-link-context
  • apollo-link-error

The httplink should be a the end of the link array.


In my case, i solved the issue, changing the order in array, example:

Before:

const links = [...middlewares, localLink, authLink, httpLink, errorLink]

After:

const links = [...middlewares, localLink, authLink, errorLink, httpLink]

Tags:

Apollo

Graphql