Unexpected end of JSON input on Netlify deploy

Hello there,

we got some ultra random issues when deploying on netlify. Sometimes, the deploy randomly returns a json issue “Unexpected end of JSON input”. When we retry the deployment, that works without changing anythings.

It’s very strange and very random. This issue can appear many times a day and never show again for a week.

Our website is made with gridsome that load content on Pantheon website with graphQL. The repo is on bitbucket and when we commit on git, that deploy on Netlify.

Did you have seen that issue before ?

Thanks.

The website :

The deploy log :
9:33:26 AM: Build ready to start
9:33:28 AM: build-image version: ca811f47d4c1cbd1812d1eb6ecb0c977e86d1a1d
9:33:28 AM: build-image tag: v3.3.20
9:33:28 AM: buildbot version: be8ecf2af866e16fa4301cc5c14de2ccbbb21cf4
9:33:28 AM: Fetching cached dependencies
9:33:28 AM: Starting to download cache of 334.5MB
9:33:29 AM: Finished downloading cache in 1.454220086s
9:33:29 AM: Starting to extract cache
9:33:40 AM: Finished extracting cache in 10.840338288s
9:33:40 AM: Finished fetching cache in 12.383694425s
9:33:40 AM: Starting to prepare the repo for build
9:33:41 AM: Preparing Git Reference refs/heads/master
9:33:43 AM: Different publish path detected, going to use the one specified in the Netlify configuration file: ‘dist’ versus ‘’ in the Netlify UI
9:33:43 AM: Different build command detected, going to use the one specified in the Netlify configuration file: ‘gridsome build’ versus ‘’ in the Netlify UI
9:33:43 AM: Starting build script
9:33:43 AM: Installing dependencies
9:33:43 AM: Python version set to 2.7
9:33:43 AM: Started restoring cached node version
9:33:46 AM: Finished restoring cached node version
9:33:47 AM: v10.22.0 is already installed.
9:33:48 AM: Now using node v10.22.0 (npm v6.14.6)
9:33:48 AM: Started restoring cached build plugins
9:33:48 AM: Finished restoring cached build plugins
9:33:48 AM: Attempting ruby version 2.6.2, read from environment
9:33:49 AM: Using ruby version 2.6.2
9:33:49 AM: Using PHP version 5.6
9:33:49 AM: 5.2 is already installed.
9:33:49 AM: Using Swift version 5.2
9:33:49 AM: Started restoring cached node modules
9:33:49 AM: Finished restoring cached node modules
9:33:50 AM: Started restoring cached go cache
9:33:51 AM: Finished restoring cached go cache
9:33:51 AM: Installing Go version 1.12
9:33:51 AM: unset GOOS;
9:33:51 AM: unset GOARCH;
9:33:51 AM: export GOROOT=‘/opt/buildhome/.gimme_cache/versions/go1.12.linux.amd64’;
9:33:51 AM: export PATH=“/opt/buildhome/.gimme_cache/versions/go1.12.linux.amd64/bin:${PATH}”;
9:33:51 AM: go version >&2;
9:33:51 AM: export GIMME_ENV=‘/opt/buildhome/.gimme_cache/env/go1.12.linux.amd64.env’;
9:33:51 AM: go version go1.12 linux/amd64
9:33:51 AM: Installing missing commands
9:33:51 AM: Verify run directory
9:33:52 AM: ​
9:33:52 AM: ┌─────────────────────────────┐
9:33:52 AM: │ Netlify Build │
9:33:52 AM: └─────────────────────────────┘
9:33:52 AM: ​
9:33:52 AM: ❯ Version
9:33:52 AM: @netlify/build 3.0.1
9:33:52 AM: ​
9:33:52 AM: ❯ Flags
9:33:52 AM: deployId: 5f1fd4c6743af3d8d23becb1
9:33:52 AM: mode: buildbot
9:33:52 AM: ​
9:33:52 AM: ❯ Current directory
9:33:52 AM: /opt/build/repo
9:33:52 AM: ​
9:33:52 AM: ❯ Config file
9:33:52 AM: /opt/build/repo/netlify.toml
9:33:52 AM: ​
9:33:52 AM: ❯ Context
9:33:52 AM: production
9:33:53 AM: ​
9:33:53 AM: ❯ Loading plugins
9:33:53 AM: - netlify-plugin-debug-cache@1.0.3 from Netlify app
9:33:53 AM: - netlify-plugin-image-optim@0.3.0 from Netlify app
9:33:53 AM: - netlify-plugin-inline-source@1.0.4 from Netlify app
9:33:53 AM: - netlify-plugin-minify-html@0.2.3 from Netlify app
9:33:53 AM: - @netlify/plugin-sitemap@0.3.4 from Netlify app
9:33:53 AM: - netlify-plugin-inline-critical-css@1.1.1 from Netlify app
9:34:04 AM: ​
9:34:04 AM: ┌────────────────────────────────────┐
9:34:04 AM: │ 1. build.command from netlify.toml │
9:34:04 AM: └────────────────────────────────────┘
9:34:04 AM: ​
9:34:04 AM: $ gridsome build
9:34:05 AM: Gridsome v0.7.13
9:34:06 AM: Initializing plugins…
9:34:06 AM: Loading data from https://test-malfygin.pantheonsite.io
9:34:41 AM: Load sources - 35.46s
9:34:45 AM: Create GraphQL schema - 3.66s
9:34:46 AM: Create pages and templates - 1.39s
9:34:46 AM: Generate temporary code - 0.06s
9:34:46 AM: Bootstrap finish - 41.36s
9:34:46 AM: Compiling assets…
9:35:02 AM: Compile assets - 15.74s
9:35:46 AM: An error occurred while executing page-query for src/pages/Index.vue
9:35:46 AM:
9:35:46 AM: Error: Unexpected end of JSON input
9:35:46 AM: GraphQL request:43:5
9:35:46 AM: 42 | }
9:35:46 AM: 43 | products(where: { lang: $lang }) {
9:35:46 AM: | ^
9:35:46 AM: 44 | nodes {
9:35:46 AM: at throwError (/opt/build/repo/node_modules/gridsome/lib/app/build/executeQueries.js:21:13)
9:35:46 AM: at pMap (/opt/build/repo/node_modules/gridsome/lib/app/build/executeQueries.js:50:9)
9:35:46 AM: at process._tickCallback (internal/process/next_tick.js:68:7)

hey nico! that sounds frustrating - things that appear and re-appear without a pattern - :scream:

I just ran a quick search and it seems like a few people have posted before with that error message:

https://answers.netlify.com/search?q=Unexpected%20end%20of%20JSON%20input

before we start digging, maybe look through those threads and see if you can find any clues?

Sorry for the long time to reply. Yeah i have looked at the community site but there is nobody who has the same issue.

I just had the same issue this afternoon. The build wont works 3 times and then suddenly works just after without making any change, i don’t understand what can be this kind of issue.

That can be an issue on the server that serve the WordPress data but there is no clear error message, no logs, that’s disconcerting.

Thanks.

Hi, @Nico. It sounds like there is a failure to return the expected data when you make the open graph query. That is just a best guess based on the log message.

Our support team doesn’t have any other data about the cause of this error. We are examining the same logs you are seeing.

If the logs don’t reveal the root cause of the issue, then our recommendation is to improve the logging done by your code so that the root cause can be identified.

To summarize, we don’t control what is logged. You control what is logged. If your logging doesn’t show enough information to debug the issue then you will need to improve the logging so you can debug it.

If there are other questions or concerns, please let us know.