question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[GROQ] FetchError: invalid json response body at, white space is causing query error

See original GitHub issue

If 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:open
  • Created 3 years ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
darenmalfaitcommented, Nov 24, 2021

Thank you @Jesperpaulsen, I’ll update my comment with that one.

1reaction
darenmalfaitcommented, Jul 29, 2021

I’m having the same issue. When adding query.replace(/\s/g, "") to my query everything works.

Read more comments on GitHub >

github_iconTop Results From Across the Web

FetchError: invalid json response body - Stack Overflow
I'm using node-fetch to send some json data to an IFTTT restpoint. The data is successfully sent to the endpoint, but I'm getting...
Read more >
npm invalid json response body - You.com | The AI Search ...
sanity-io/sanity[GROQ] FetchError: invalid json response body at, white space is causing query error#2288. Created almost 2 years ago.
Read more >
Error messages | BigQuery - Google Cloud
Error message HTTP code Description stopped 200 This status code returns when a job is canceled. timeout 400 The job timed out.
Read more >
Firebase Apple SDK Release Notes - Google
App Distribution now signs out the tester when the call to fetch releases fails with an unauthenticated error. Crash caused by trying to...
Read more >
Microsoft Team rule error: 'unexpected token s in json at ...
Problem When attempting to connect a rule to Microsoft Teams, ... Max re-tries reached. fetcherror: invalid json response body at [URL] ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found