Open toddpadwick opened 3 years ago
@toddpadwick I have the same problem, did you manage to fix this?
Hey @costas90 Sort of... but not in the way you might be hoping for: I ended up switching back to Smart Queries throughout as I found a way to trigger Smart Queries manually just like a method: Check this solution out. 'Onurkose's solution works quite well and so I've now found I don't ever need to use Apollo inside a method again. hope that helps!
I have set up the default client config with a full HTTPS URL as the
httpEndpoint
(api.madefair.org). However, in the production build, queries in methods seem to use a relative path to/graphql
which result in a 404. The strange thing is, these methods work fine in the development build and also work fine with smart queries.Here is one of my methods:
Here is my default client. config
The error I get is as follows:
Notice that the URL it is attempting to query is not the URL in the http Endpoint. so it seems to have used a relative URL of just
graphql
and appended it to the current client URL. where could it have created that from?I am assuming the unexpected token error is just because its HTML returned from a 404, rather than json. So the only thing I need to solve here, is to ensure Apollo Client always uses the httpEndpoint provided in the default client config.