Description
Hi guys!
I think this is the same problem that @bbigras had (but the Stale BOT closed it without a proper fix).
I created a small reproduction here: https://github.com/frederikhors/iss-async-graphql-apq-urql.git.
In it's README.md you can read:
To start
cargo run
- in another tab
cd web && npm install && npm run dev
Problem
If you open the browser (http://localhost:5000) in the console you can read the error:
start.js:312 GET http://localhost:8000/?variables=%7B%7D&extensions=%7B%22persistedQuery%22%3A%7B%22sha256Hash%22%3A%22cde5de0a350a19c59f8ddcd9646e5f260b2a7d5649ff6be8e63e9462934542c3%22%2C%22version%22%3A1%7D%7D 400 (Bad Request)
The backend response is:
Io(Custom { kind: Other, error: "failed to parse graphql request from uri query: invalid type: string \"{}\", expected a map" })
If I remove the line persistedFetchExchange({ preferGetForPersistedQueries: true })
from index.svelte
it works (because it's using the POST
method now and not the Automatic persisted queries anymore).
Proposal
I think we should fix this because both Apollo & Urql (so the 90% of web projects) use the same API/functioning.
Practically today it is not possible to use this method with async-graphql at all.
Ref
- Urql docs page about it: https://formidable.com/open-source/urql/docs/api/persisted-fetch-exchange
Thank you very much for your work on this amazing project!