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.

invalid json response with templates (gatsby)

See original GitHub issue

When developing or building in Gatsby I’m getting error messages when trying to fetch the templates

However if I try to remove mdx files to isolate which file is causing the error (the error messages don’t give a clue), I end up without any consistent finding, and this error comes and goes without any apparent explanation

At this point I am suspecting that too many files are causing this error (as if gatsby was claiming the templates multiple times instead of implementing some sort of cache), but only an hypothesis

If I manually go to the template links I can see the file without problem, now I’ll try to use local files instead, but before I wanted to ask here whether this is something known

success building schema - 0.367s

 ERROR 

Failed to get the sandbox template: vanilla


 ERROR 

Failed to get the sandbox template: new


 ERROR 

Failed to get the sandbox template: new


 ERROR 

Failed to get the sandbox template: new


 ERROR 

Failed to get the sandbox template: vanilla


 ERROR 

invalid json response body at https://codesandbox.io/api/v1/sandboxes/vanilla reason: Unexpected token < in JSON at position 0



  FetchError: invalid json response body at https://codesandbox.io/api/v1/sandboxes/vanilla reason: Unexpected token < in JSON at position 0

  - body.js:48 
    [kuworking]/[isomorphic-fetch]/[node-fetch]/lib/body.js:48:31

  - task_queues.js:97 processTicksAndRejections
    internal/process/task_queues.js:97:5

  - getTemplate.js:67 getTemplate
    [kuworking]/[remark-codesandbox]/src/getTemplate.js:67:24

  - index.js:84 transformer
    [kuworking]/[remark-codesandbox]/src/index.js:84:24

  - get-source-plugins-as-remark-plugins.js:59 transformer
    [kuworking]/[gatsby-plugin-mdx]/utils/get-source-plugins-as-remark-plugins.js:59:11



 ERROR 

invalid json response body at https://codesandbox.io/api/v1/sandboxes/new reason: Unexpected token < in JSON at position 0



  FetchError: invalid json response body at https://codesandbox.io/api/v1/sandboxes/new reason: Unexpected token < in JSON at position 0

  - body.js:48 
    [kuworking]/[isomorphic-fetch]/[node-fetch]/lib/body.js:48:31

  - runMicrotasks

  - task_queues.js:97 processTicksAndRejections
    internal/process/task_queues.js:97:5

  - getTemplate.js:67 getTemplate
    [kuworking]/[remark-codesandbox]/src/getTemplate.js:67:24

  - getTemplate.js:38 getTemplate
    [kuworking]/[remark-codesandbox]/src/getTemplate.js:38:26

  - index.js:84 transformer
    [kuworking]/[remark-codesandbox]/src/index.js:84:24

  - get-source-plugins-as-remark-plugins.js:59 transformer
    [kuworking]/[gatsby-plugin-mdx]/utils/get-source-plugins-as-remark-plugins.js:59:11



 ERROR 

invalid json response body at https://codesandbox.io/api/v1/sandboxes/new reason: Unexpected token < in JSON at position 0



  FetchError: invalid json response body at https://codesandbox.io/api/v1/sandboxes/new reason: Unexpected token < in JSON at position 0

  - body.js:48 
    [kuworking]/[isomorphic-fetch]/[node-fetch]/lib/body.js:48:31

  - runMicrotasks

  - task_queues.js:97 processTicksAndRejections
    internal/process/task_queues.js:97:5

  - getTemplate.js:67 getTemplate
    [kuworking]/[remark-codesandbox]/src/getTemplate.js:67:24

  - getTemplate.js:38 getTemplate
    [kuworking]/[remark-codesandbox]/src/getTemplate.js:38:26

  - index.js:84 transformer
    [kuworking]/[remark-codesandbox]/src/index.js:84:24

  - get-source-plugins-as-remark-plugins.js:59 transformer
    [kuworking]/[gatsby-plugin-mdx]/utils/get-source-plugins-as-remark-plugins.js:59:11



 ERROR 

invalid json response body at https://codesandbox.io/api/v1/sandboxes/new reason: Unexpected token < in JSON at position 0



  FetchError: invalid json response body at https://codesandbox.io/api/v1/sandboxes/new reason: Unexpected token < in JSON at position 0

  - body.js:48 
    [kuworking]/[isomorphic-fetch]/[node-fetch]/lib/body.js:48:31

  - runMicrotasks

  - task_queues.js:97 processTicksAndRejections
    internal/process/task_queues.js:97:5

  - getTemplate.js:67 getTemplate
    [kuworking]/[remark-codesandbox]/src/getTemplate.js:67:24

  - getTemplate.js:38 getTemplate
    [kuworking]/[remark-codesandbox]/src/getTemplate.js:38:26

  - index.js:84 transformer
    [kuworking]/[remark-codesandbox]/src/index.js:84:24

  - get-source-plugins-as-remark-plugins.js:59 transformer
    [kuworking]/[gatsby-plugin-mdx]/utils/get-source-plugins-as-remark-plugins.js:59:11



 ERROR 

invalid json response body at https://codesandbox.io/api/v1/sandboxes/vanilla reason: Unexpected token < in JSON at position 0



  FetchError: invalid json response body at https://codesandbox.io/api/v1/sandboxes/vanilla reason: Unexpected token < in JSON at position 0

  - body.js:48 
    [kuworking]/[isomorphic-fetch]/[node-fetch]/lib/body.js:48:31

  - runMicrotasks

  - task_queues.js:97 processTicksAndRejections
    internal/process/task_queues.js:97:5

  - getTemplate.js:67 getTemplate
    [kuworking]/[remark-codesandbox]/src/getTemplate.js:67:24

  - index.js:84 transformer
    [kuworking]/[remark-codesandbox]/src/index.js:84:24

  - get-source-plugins-as-remark-plugins.js:59 transformer
    [kuworking]/[gatsby-plugin-mdx]/utils/get-source-plugins-as-remark-plugins.js:59:11

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
kuworkingcommented, Sep 24, 2020

Yes, versions are now updated 🙌🙌🙌

0reactions
kevin940726commented, Sep 23, 2020

Ahh! My bad! I just updated gatsby-remark-inline-codesandbox to 0.6.1 then! Please upgrade it and try again.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"gatsby-source-graphql" threw an error while running ... - GitHub
This error means that the client fails to parse the server response. Have you tried running the same GraphQL query against your remote...
Read more >
Troubleshooting Common Errors - Gatsby
This generally happens when plugins that are used together are added in the gatsby-config in the wrong order, or haven't been added at...
Read more >
0 - Stack Overflow
npm install: npm ERR! invalid json response body at https://registry.npmjs.org/axios reason: Unexpected end of JSON input.
Read more >
API Routes: Response Helpers - Next.js
API Routes include a set of Express.js-like methods for the response to help you creating new API endpoints. Learn how it works here....
Read more >
Advanced GraphQL Usage In Gatsby Websites
With GraphQL, a client/consumer can request exactly the data it requires. The server/provider responds with a JSON response signature matching ...
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