Build fails on push but not when locally built and deployed using Netlify CLI

Hi guys!

I am currently building my blog using Netlify and Gridsome.
I recently added a new section called “Gallery” using the Gridsome “@gridsome/source-filesystem” plug-in.
With this plug-in, new pages are created using Markdown files and the information contained in these files can be retrieved using GraphQL queries.

When I build my website locally and then deploy it to Netlify everything is fine and working as it should be. However, when I push to Github and thus trigger the build on Netlify and error appears and it looks like this error is due to the fact that the GraphQL scheme is not properly built.
I checked Gridsome versions since the build is made using it and my version is the same as the one installed during build (v0.7.13).

The null from cannot read src of null is the information that is supposed to be acquired by the GraphQL Query but it looks that during the build, it doesn’t exist.

What strikes me is that I have another section created in the same way and it works…
I don’t know if something that should be pushed to Github is not or if it comes from something else…

Maybe someone already encountered this.

Many thanks in advance!

Here is the result of the build:

4:26:30 PM: Build ready to start
4:26:32 PM: build-image version: 2dbd444fcdce00cf06325060a8238d5ae3e86774
4:26:32 PM: build-image tag: v3.3.7
4:26:32 PM: buildbot version: 7f867b365e4c3934ca5b72b9d51f0a4d1f96685d
4:26:32 PM: Fetching cached dependencies
4:26:33 PM: Failed to fetch cache, continuing with build
4:26:33 PM: Starting to prepare the repo for build
4:26:33 PM: Netlify Large Media is enabled, running git commands with GIT_LFS_SKIP_SMUDGE=1
4:26:33 PM: No cached dependencies found. Cloning fresh repo
4:26:33 PM: git clone https://github.com/cyrillajarge/cl-visuals-gridsome-blog-v2
4:26:35 PM: Preparing Git Reference refs/heads/master
4:26:35 PM: Found Netlify configuration file netlify.toml in site root
4:26:35 PM: Found Netlify configuration file(s). Overriding site configuration
4:26:35 PM: Different functions path detected, going to use the one specified in the Netlify configuration file: 'functions' versus '' in the Netlify UI
4:26:35 PM: Creating functions prep folder
4:26:35 PM: Starting build script
4:26:36 PM: Installing dependencies
4:26:37 PM: Downloading and installing node v10.20.1...
4:26:37 PM: Downloading https://nodejs.org/dist/v10.20.1/node-v10.20.1-linux-x64.tar.xz...
4:26:37 PM: 
#######
4:26:37 PM: ###########                                                        25.4%
4:26:37 PM: 
########################################################################
4:26:37 PM: 100.0%
4:26:37 PM: Computing checksum with sha256sum
4:26:37 PM: Checksums matched!
4:26:40 PM: Now using node v10.20.1 (npm v6.14.4)
4:26:40 PM: Attempting ruby version 2.6.2, read from environment
4:26:41 PM: Using ruby version 2.6.2
4:26:42 PM: Using PHP version 5.6
4:26:42 PM: Started restoring cached node modules
4:26:42 PM: Finished restoring cached node modules
4:26:42 PM: Installing NPM modules using NPM version 6.14.4
4:27:05 PM: > sharp@0.23.4 install /opt/build/repo/node_modules/sharp
4:27:05 PM: > (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
4:27:05 PM: info
4:27:05 PM: sharp
4:27:05 PM:  Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.8.1/libvips-8.8.1-linux-x64.tar.gz
4:27:07 PM: > node-sass@4.13.1 install /opt/build/repo/node_modules/node-sass
4:27:07 PM: > node scripts/install.js
4:27:07 PM: Downloading binary from https://github.com/sass/node-sass/releases/download/v4.13.1/linux-x64-64_binding.node
4:27:08 PM: Download complete
4:27:08 PM: Binary saved to /opt/build/repo/node_modules/node-sass/vendor/linux-x64-64/binding.node
4:27:08 PM: Caching binary to /opt/buildhome/.npm/node-sass/4.13.1/linux-x64-64_binding.node
4:27:08 PM: > core-js@3.6.5 postinstall /opt/build/repo/node_modules/core-js
4:27:08 PM: > node -e "try{require('./postinstall')}catch(e){}"
4:27:08 PM: Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
4:27:08 PM: The project needs your help! Please consider supporting of core-js on Open Collective or Patreon: 
4:27:08 PM: > https://opencollective.com/core-js 
4:27:08 PM: > https://www.patreon.com/zloirock 
4:27:08 PM: Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
4:27:08 PM: > cwebp-bin@5.1.0 postinstall /opt/build/repo/node_modules/cwebp-bin
4:27:08 PM: > node lib/install.js
4:27:09 PM:   ✔ cwebp pre-build test passed successfully
4:27:09 PM: > mozjpeg@6.0.1 postinstall /opt/build/repo/node_modules/mozjpeg
4:27:09 PM: > node lib/install.js
4:27:09 PM:   ✔ mozjpeg pre-build test passed successfully
4:27:09 PM: > pngquant-bin@5.0.2 postinstall /opt/build/repo/node_modules/pngquant-bin
4:27:09 PM: > node lib/install.js
4:27:10 PM:   ✔ pngquant pre-build test passed successfully
4:27:10 PM: > node-sass@4.13.1 postinstall /opt/build/repo/node_modules/node-sass
4:27:10 PM: > node scripts/build.js
4:27:10 PM: Binary found at /opt/build/repo/node_modules/node-sass/vendor/linux-x64-64/binding.node
4:27:10 PM: Testing binary
4:27:10 PM: Binary is fine
4:27:12 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.12 (node_modules/fsevents):
4:27:12 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.12: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
4:27:12 PM: added 1494 packages from 726 contributors and audited 27572 packages in 29.099s
4:27:13 PM: 77 packages are looking for funding
4:27:13 PM:   run `npm fund` for details
4:27:13 PM: found 1 low severity vulnerability
4:27:13 PM:   run `npm audit fix` to fix them, or `npm audit` for details
4:27:13 PM: NPM modules installed
4:27:13 PM: Started restoring cached go cache
4:27:13 PM: Finished restoring cached go cache
4:27:13 PM: unset GOOS;
4:27:13 PM: unset GOARCH;
4:27:13 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.12.linux.amd64';
4:27:13 PM: export PATH="/opt/buildhome/.gimme/versions/go1.12.linux.amd64/bin:${PATH}";
4:27:13 PM: go version >&2;
4:27:13 PM: export GIMME_ENV='/opt/buildhome/.gimme/env/go1.12.linux.amd64.env';
4:27:13 PM: go version go1.12 linux/amd64
4:27:13 PM: Installing missing commands
4:27:13 PM: Verify run directory
4:27:13 PM: Executing user command: npm run build
4:27:14 PM: > cl-visuals@ build /opt/build/repo
4:27:14 PM: > gridsome build
4:27:14 PM: Gridsome v0.7.13
4:27:15 PM: Initializing plugins...
4:27:15 PM: Load sources - 0.06s
4:27:15 PM: Create GraphQL schema - 0.1s
4:27:15 PM: Create pages and templates - 0.07s
4:27:16 PM: Generate temporary code - 0.04s
4:27:16 PM: Bootstrap finish - 1.36s
4:27:16 PM: Compiling assets...
4:27:42 PM: Compile assets - 26.9s
4:27:43 PM: Execute GraphQL (23 queries) - 0.12s
4:27:43 PM: Write out page data (23 files) - 0.01s
4:27:44 PM: Could not generate HTML for "/gallery/gallery-1/":
4:27:44 PM: TypeError: Cannot read property 'src' of null
4:27:44 PM:     at assets/js/page--src--templates--gallery-vue.d7068be7.js:96:359
4:27:44 PM:     at a.pe [as _l] (/opt/build/repo/node_modules/vue/dist/vue.runtime.common.prod.js:6:15887)
4:27:44 PM:     at a.ImageGalleryvue_type_template_id_07dfd593_render (src/components/ImageGallery.vue?1e85:1:89)
4:27:44 PM:     at a.t._render (/opt/build/repo/node_modules/vue/dist/vue.runtime.common.prod.js:6:35273)
4:27:44 PM:     at /opt/build/repo/node_modules/vue-server-renderer/build.prod.js:1:70603
4:27:44 PM:     at Yi (/opt/build/repo/node_modules/vue-server-renderer/build.prod.js:1:67167)
4:27:44 PM:     at io (/opt/build/repo/node_modules/vue-server-renderer/build.prod.js:1:70579)
4:27:44 PM:     at ro (/opt/build/repo/node_modules/vue-server-renderer/build.prod.js:1:70210)
4:27:44 PM:     at _t.eo [as renderNode] (/opt/build/repo/node_modules/vue-server-renderer/build.prod.js:1:67457)
4:27:44 PM:     at _t.next (/opt/build/repo/node_modules/vue-server-renderer/build.prod.js:1:20473)
4:27:44 PM: npm
4:27:44 PM:  ERR! code
4:27:44 PM:  ELIFECYCLE
4:27:44 PM: npm ERR!
4:27:44 PM:  errno 1
4:27:44 PM: npm
4:27:44 PM: ERR! cl-visuals@ build: `gridsome build`
4:27:44 PM: npm ERR!
4:27:44 PM:  Exit status 1
4:27:44 PM: npm ERR!
4:27:44 PM: npm
4:27:44 PM: ERR!
4:27:44 PM:  Failed at the cl-visuals@ build script.
4:27:44 PM: npm
4:27:44 PM:  ERR! This is probably not a problem with npm. There is likely additional logging output above.
4:27:44 PM: npm
4:27:44 PM:  ERR! A complete log of this run can be found in:
4:27:44 PM: npm
4:27:44 PM: ERR!     /opt/buildhome/.npm/_logs/2020-04-13T14_27_44_554Z-debug.log
4:27:44 PM: Function Dir: /opt/build/repo/functions
4:27:44 PM: TempDir: /tmp/zisi-5e94769668946212a12da81d
4:27:44 PM: Prepping functions with zip-it-and-ship-it 0.3.1
4:27:45 PM: [ { path: '/tmp/zisi-5e94769668946212a12da81d/instagram_feed.zip',
4:27:45 PM:     runtime: 'js' } ]
4:27:45 PM: Prepping functions complete
4:27:45 PM: Caching artifacts
4:27:45 PM: Started saving node modules
4:27:45 PM: Finished saving node modules
4:27:45 PM: Started saving pip cache
4:27:45 PM: Finished saving pip cache
4:27:45 PM: Started saving emacs cask dependencies
4:27:45 PM: Finished saving emacs cask dependencies
4:27:45 PM: Started saving maven dependencies
4:27:45 PM: Finished saving maven dependencies
4:27:45 PM: Started saving boot dependencies
4:27:45 PM: Finished saving boot dependencies
4:27:45 PM: Started saving go dependencies
4:27:45 PM: Finished saving go dependencies
4:27:50 PM: Error running command: Build script returned non-zero exit code: 1
4:27:50 PM: Failing build: Failed to build site
4:27:50 PM: failed during stage 'building site': Build script returned non-zero exit code: 1
4:27:50 PM: Finished processing build request in 1m18.326948882s`

Hi Kyril and welcome to our community!

To start with, building locally uses your computer, and building here uses ours. The difference in config is the usual reason for builds failing here but not there, and our usual debugging steps are described here:

I can see you’ve maybe heard that advice already, since you checked gridsome versions (and thank you for mentioning that!), but also check node versions and $NODE_ENV and the rest desribed there, please!

If all of that fails, could you tell us what happened when you tried to build locally in our container? https://github.com/netlify/build-image#running-locally

If you’re still not finding a fix, in the end, it will be useful to get a link to your deploy logs rather than just the quote, so we can examine your site settings in the database directly.