[GROQ] FetchError: invalid json response body at, white space is causing query error
See original GitHub issueIf you find a security vulnerability, do NOT open an issue. Email security@sanity.io instead.
Describe the bug
There is an error querying from next-sanity
client, if I try the same query using the vision plugin from the studio it works as expected. It also works if I remove all the white spaces from my string query
the error from client reason: Unexpected token < in JSON at position 0
To Reproduce
not sure how to reproduce but this occurs at the five child level, it fails at this part
typeObject{
...,
property1{
...,
child1,
child2{
property2,
"tag": property.item
}
}
}
but If I change to this it works, note that the child1 and child2 are now on the same row, If I use a new line for child2 it does not work.
typeObject{
...,
property1{
..., child1, child2}
}
Expected behavior json data
Screenshots If applicable, add screenshots to help explain your problem.
Which versions of Sanity are you using?
@sanity/cli 2.2.6 (up to date) @sanity/block-content-to-react 2.0.7 (up to date) @sanity/cli 2.2.6 (up to date)
What operating system are you using? Linux Pop! os (ubuntu based)
Which versions of Node.js / npm are you running? npm 6.14.11 node v12.18.2
Additional context
Add any other context about the problem here. As way a round I remove all the white spaces with query.replace(/\s/g, “”) and it’s working fine now, this is not consistent behavior
Issue Analytics
- State:
- Created 3 years ago
- Comments:9
Thank you @Jesperpaulsen, I’ll update my comment with that one.
I’m having the same issue. When adding
query.replace(/\s/g, "")
to my query everything works.