Here's the error message I get when doing a query :
[Network error]: ServerParseError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
The query works fine locally, when setting the uri of my ApolloClient to http://localhost:4000/graphql
, and running the server locally.
However, if I deploy my server to heroku, then set the client's uri to https://my-app.herokuapp.com/
it does not work, I get the error message above. The network tab shows a 404 to the POST request to my heroku app, "cannot POST"
The heroku logs show no error upon pushing.
Any idea what I am missing here ? I have checked all the tutorials I could find, and I don't see anything obvious missing.
Here's my client request :
const client = new ApolloClient({
uri: 'https://my-app.herokuapp.com/',
headers: {
authorization: "Bearer API_KEY",
'content-type': 'application/json'
}
});