Closed techyrajeev closed 5 years ago
Hi, as https://github.com/apollographql/apollo-link-persisted-queries this github readme says,
useGETForHashedQueries: set to true to use the HTTP GET method when sending the hashed version of queries (but not for mutations). GET requests require apollo-link-http 1.4.0 or newer, and are not compatible with apollo-link-batch-http.
I think your apollo-link-batch-http package and useGETForHashedQueries setting might have a compatibility problem.
const apqSwitch = createPersistedQueryLink({useGETForHashedQueries: true}).concat(httpLink);
let links = [errorlink, stateLink, setSiteIdHeaderLink, apqLinkSwitch]
You defined apqSwitch but in your array you use apqLinkSwitch which is undefined.
I realize it's been quite some time since you opened this, but if you haven't already figured this out (the suggestion from @ftatzky seems reasonable to me), I'd recommend taking this question to the Apollo community on Spectrum.chat to discuss it further. Thanks!
Any updates? @techyrajeev i'm facing the same issue
@vNNi Can you share a reproduction (ie, a full sequence of instructions perhaps including a git clone
or a codesandbox.io link that I can use to see your issue on my computer)?
Note that in Apollo Client 3, the persisted queries link is part of the main @apollo/client
package; see https://www.apollographql.com/docs/react/api/link/persisted-queries/
@glasser Hello! My issue (maybe) are related with timeout by the backend from client call and the persisted link return as PERSISTED_QUERY_NOT_FOUND
.. I add more seconds and the times i receive not found was close to none.
Obs: I'm using Apollo timeout link and persisted link together.
OK, that's not a reproduction so it won't help me help you.
I had the problem and it was because I had handled errors manually in my gateway (just to remove some exposing my server), if someone is doing that then know that the frontend client expect the all error as produced by the server, in my case I was only sending the message, you can check that error is for now query found then just permit the all thing
The problem is the formatError
function. @apollo/client
needs to know when it has to resend the query and it uses the GraphQL error message to detect the error. This doesn't work when returning a custom error via formatError
.
The error message must be PersistedQueryNotFound
. For some reason it uses the message instead of the unique PERSISTED_QUERY_NOT_FOUND error code to detect the error.
The problem is the
formatError
function.
Great catch @electerious! You saved me a lot of time debugging why code that worked in test didn't work in production (where we scrub error messages).
@trevorr really good point — I've filed an issue in Apollo Client about this. Would probably make a pretty easy PR over there! https://github.com/apollographql/apollo-client/issues/10253
I tried to use highly advertised Automatic persisted query for performance benefits in Graphql based system but after spending three days I couldn't fix below problem. Apollo documents has lots of 404 pages for this topic if you try to look up -
On Client:
I used
client dependencies:
On Server:
Server dependencies:
Observations:
variables=%7B%7D&extensions=%7B%22persistedQuery%22%3A%7B%22version%22%3A1%2C%22sha256Hash%22%3A%22fd4c5f1ae3sfsf6ee0f0710b8d303a9703db7a6708b401278e2fd664f56f4e91762f%22%7D%7D
After that nothing happens there is no set operation is performed in redis cache and continuously getting PERSISTED_QUERY_NOT_FOUND error
Issue: APQ is not working