Graphcool request works fine on local but not after deployed

framework

#1

Hello there,
I’m trying to deploy my test app to my domain, and I got everything working on local,
but after I deploy, the call throws a 200 status and no response.

This is how I initialized it with apollo-client


// graphQL Client Setup
const client = new ApolloClient({
  link: new HttpLink({ uri: `https://api.graph.cool/simple/v1/${GRAPHCOOL_ID}`}),
  cache: new InMemoryCache(),
})

And I’m just making simple queries, no mutations or anything that would fail like that.
What am I missing?

Thanks


#2

Resolved by adding the authentication header.

const link = createHttpLink({ uri: `https://api.graph.cool/simple/v1/${GRAPHCOOL_ID` });
const authLink = setContext((_, { headers })=>{
  return {
    headers: {
      ...headers,
      authorization: `Bearer ${GRAPHCOOL_AUTHTOKEN}`
    }
  }
});