genql
genql copied to clipboard
Handling Hasura authentication error with batched queries
Hi!
I'm using a Genql client to access an Hasura instance with a JWT Authentication header and I struggle to handle the authentication error when queries are batched because the Genql fetcher throw a:
Error: response length did not match query length.
On page load I have two queries GetApp and GetUser, so the request body look like that:
{query: "query GetApp{app{name}}", variables: {}}
{query: "query GetUser{user{name,lastname}}", variables: {}}
And the response is:
{
"errors": [
{
"message": "Could not verify JWT: JWSError JWSInvalidSignature",
"extensions": {
"path": "$",
"code": "invalid-jwt"
}
}
]
}
So I get why the fetcher is throwing that, but do I have any way to access/handle this kind of response without disabling batching?