TLDR:
The persisted query link requires using the HttpLink. (see link to their doc bellow).
Is it possible to set up MultiAPILink using HttpLink? (instead of createHttpLink)
Longer explanation:
Hello, in apollo-client.ts I had implemented PersistendQueryLink, based on https://www.apollographql.com/docs/react/api/link/persisted-queries/
I have const links = [] and then push there errorLink, authorizationLink, (retry link), following by:
if (process.env.NODE_ENV === 'production') {
const persistedQueryLink = createPersistedQueryLink({ sha256 })
links.push(persistedQueryLink)
}
const retryLink = new RetryLink()
links.push(retryLink)
const httpLink = new MultiAPILink({
createHttpLink: () => createHttpLink(),
endpoints,
httpSuffix: '',
wsSuffix: '',
})
links.push(httpLink)
export const client = new ApolloClient({
cache,
link: ApolloLink.from(links),
})
I get error from BE:
"PersistedQueryNotFoundError: PersistedQueryNotFound"
at processGraphQLRequest (/Users/david/Documents/github/datacatalog-be/node_modules/apollo-server-core/src/requestPipeline.ts:181:40)"
at processTicksAndRejections (node:internal/process/task_queues:96:5)"
at processHTTPRequest (/Users/david/Documents/github/datacatalog-be/node_modules/apollo-server-core/src/runHttpQuery.ts:434:24)"
message
:
"PersistedQueryNotFound"
Before using this library, I connected to 1 endpoint like so:
const httpLink = new HttpLink({
uri: process.env.NEXT_PUBLIC_API_URL,
})
Thus it is clear my error comes from connecting to multiple endpoints using this library.
I think answer to my problem is in sentence: The persisted query link requires using the HttpLink. (see link to their doc above).
Thus my question is, is it possible to set up MultiAPILink using HttpLink? (instead of createHttpLink). If yes, how?
TLDR:
The persisted query link requires using the
HttpLink. (see link to their doc bellow).Is it possible to set up MultiAPILink using
HttpLink? (instead ofcreateHttpLink)Longer explanation:
Hello, in apollo-client.ts I had implemented
PersistendQueryLink, based on https://www.apollographql.com/docs/react/api/link/persisted-queries/I have const
links = []and then push thereerrorLink,authorizationLink, (retry link), following by:I get error from BE:
Before using this library, I connected to 1 endpoint like so:
Thus it is clear my error comes from connecting to multiple endpoints using this library.
I think answer to my problem is in sentence: The persisted query link requires using the HttpLink. (see link to their doc above).
Thus my question is, is it possible to set up MultiAPILink using HttpLink? (instead of createHttpLink). If yes, how?