Describe the bug
Active query persistence does not seem to work with HC11. With .UseActivePersistedQueryPipeline() the server still expects all queries to contain either a query or id key. The Apollo format does not for the initial request.
To Reproduce
Example query from the Apollo docs:
curl -g 'http://localhost:4000/?extensions={"persistedQuery":{"version":1,"sha256Hash":"ecf4edb46db40b5132295c0291d62fb65d6759a9eedfa4d5d612dd5ec54a6b38"}}'
The following error message is given by HC:
{"errors":[{"message":"Either the parameter query or the parameter id has to be set.","extensions":{"code":"HC0013"}}]}
Expected behavior
The server response should be (on query cache miss):
{
"errors": [
{
"message": "PersistedQueryNotFound",
"extensions": {
"code": "PERSISTED_QUERY_NOT_FOUND"
}
}
]
}
Desktop (please complete the following information):
Additional context
N/A
@pewallin Did you figure it out? I don't think we have a end 2 end example with apollo and persisted queries. The link @michaelstaib send you shows the client configuration of persisted queries for apollo client
We also have an error with this @PascalSenn. We have some validation in the GET middleware that will not allow requests that just have extensions...
I've been following this issue for a few days, as the same thing happened to me. However, I just noticed @michaelstaib mentioning this is a GET validation issue and @pewallin's example is also GET. In my case, the issue occurs with POST requests (didn't try GET).
Its a GraphQL request validation issue :) The request is not valid if it does not expose the query id or a query document. We are reworking this and will fix it probably with 11.0.8.
Give it another week and it will be fixed I think.
The fix is now implemented. I will add a couple of tests and then we will merge and ship it.
This issue's conversation has been locked. Please file a new issue if you would like to continue the discussion.
This issue is now implemented. We also released with it the new docs for this feature.
https://chillicream.com/docs/hotchocolate/performance/
https://chillicream.com/docs/hotchocolate/performance/automatic-persisted-queries/
The current release is 11.0.8-rc.9
@arif-hanif this is the issue if you have any comments.
@pewallin @camiloclc it would be great to get feedback on the documentation and the implementation. We have completely reworked the integration now and it should be much smoother to use.
Also we have added some debug details when trying this out:
We have 5 cases essentially:
optimized request with missing query
{
"errors": [
{
"message": "PersistedQueryNotFound",
"extensions": { "code": "HC0020" }
}
]
}
{ "data": { "__typename": "Query" } }
{
"data": { "__typename": "Query" },
"extensions": {
"persistedQuery": {
"md5Hash": "71yeex4k3iYWQgg9TilDIg==",
"persisted": true
}
}
}
{
"data": { "__typename": "Query" },
"extensions": {
"persistedQuery": {
"sha256Hash": "ecf4edb46db40b5132295c0291d62fb65d6759a9eedfa4d5d612dd5ec54a6b38",
"expectedHashValue": "7f56e67dd21ab3f30d1ff8b7bed08893f0a0db86449836189b361dd1e56ddb4b",
"expectedHashType": "sha256Hash",
"expectedHashFormat": "Hex",
"persisted": false
}
}
}
{ "data": { "__typename": "Query" } }
We are releasing now.