gatsbyjs / gatsby

The best React-based framework with performance, scalability and security built in.
https://www.gatsbyjs.com
MIT License
55.27k stars 10.31k forks source link

gatsby build segfaults on netlify, not locally (vips_value_hash: no case for NULL) #29041

Closed martinhj closed 3 years ago

martinhj commented 3 years ago

Description

We got a medium sized gatsby site where we have tried to upgrade gatsby to get the benefits of the DEV_SSR-functionality. In the same progress we upgraded several gatsby* -packages and related dependencies. At first it seemed to work fine, but we have ran into some issues and need to roll back for now. But in the process I want to document our issues as best as possible. I guess issues related to our upgrade attempt, using this for a medium sized web site, would be interesting feedback now gatsby seem to be in a feature transition process .

The issue is that npm run build fails on netlify which I guess is related to us bumping gatsby-transformer-sharp and gatsby-plugin-sharp.

Steps to reproduce

It would be hard to reproduce this as the project repo is private but content and media is hosted on Contentful. The current theory is that this error happens while processing some invalid / large image. If we are able to isolate where it fails we can provide more information.

It also happens after clearing build cache and setting PARALLEL_SOURCING: false. The problem does not happen when build locally. Also tested on netlify with node version v14.15.4 with corresponding npm version.

After downgrading plugin-sharp and transformer-sharp to versions used prior to upgrade this issue was resolved (with newer version of gatsby .

Actual result

The whole netlify build output is attached further down, but the central error output is this:

10:46:26 AM: vips_value_hash: no case for NULL
10:46:26 AM:    type 64, gchararray
10:46:26 AM:    generic 55, GParamString
10:46:26 AM: vips_value_hash: no case for 0.000000
10:46:26 AM:    type 60, gdouble
10:46:26 AM:    generic 109, GParamDouble
10:46:26 AM: vips_value_hash: no case for FALSE
10:46:26 AM:    type 20, gboolean
10:46:26 AM:    generic 79, GParamBoolean
10:46:26 AM: vips_value_hash: no case for ((VipsAccess) VIPS_ACCESS_RANDOM)
10:46:26 AM:    type 50357248, VipsAccess
10:46:26 AM:    generic 81, GParamEnum
10:46:26 AM: vips_value_hash: no case for FALSE
10:46:26 AM:    type 20, gboolean
10:46:26 AM:    generic 79, GParamBoolean

Environment (local - npmPackages should be identical)

❯ ./node_modules/.bin/gatsby info --clipboard

  System:
    OS: macOS 11.1
    CPU: (12) x64 Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.15.3 - /usr/local/opt/node@14/bin/node
    npm: 6.14.9 - /usr/local/opt/node@14/bin/npm
  Languages:
    Python: 2.7.16 - /usr/bin/python
  Browsers:
    Chrome: 87.0.4280.141
    Edge: 87.0.664.75
    Firefox: 85.0
    Safari: 14.0.2
  npmPackages:
    gatsby: ^2.30.2 => 2.30.2
    gatsby-image: 2.4.19 => 2.4.19
    gatsby-plugin-google-analytics: 2.3.14 => 2.3.14
    gatsby-plugin-manifest: 2.4.28 => 2.4.28
    gatsby-plugin-netlify: 2.3.14 => 2.3.14
    gatsby-plugin-preload-fonts: 1.6.0 => 1.6.0
    gatsby-plugin-react-helmet: 3.3.10 => 3.3.10
    gatsby-plugin-react-svg: ^3.0.0 => 3.0.0
    gatsby-plugin-robots-txt: ^1.5.5 => 1.5.5
    gatsby-plugin-sass: ^3.0.0 => 3.0.0
    gatsby-plugin-sharp: ^2.12.1 => 2.12.1
    gatsby-plugin-sitemap: ^2.4.12 => 2.10.0
    gatsby-plugin-webpack-bundle-analyzer: 1.0.5 => 1.0.5
    gatsby-source-contentful: 3.1.1 => 3.1.1
    gatsby-transformer-sharp: ^2.10.1 => 2.10.1

Working with following versions after downgrade:

    gatsby-plugin-sharp: ^2.6.35
    gatsby-transformer-sharp: 2.5.14

Netlify build output

10:43:53 AM: Build ready to start
10:43:54 AM: build-image version: 53b83b6bede2920f236b25b6f5a95334320dc849
10:43:54 AM: build-image tag: v3.6.0
10:43:54 AM: buildbot version: 7d7f8cd4cc19a5205bae0ea8df58feec103fed05
10:43:54 AM: Building without cache
10:43:54 AM: Starting to prepare the repo for build
10:43:55 AM: No cached dependencies found. Cloning fresh repo
10:43:55 AM: git clone https://github.com/#####################################################
10:43:59 AM: Preparing Git Reference pull/1557/head
10:44:01 AM: Starting build script
10:44:01 AM: Installing dependencies
10:44:01 AM: Python version set to 2.7
10:44:03 AM: Downloading and installing node v10.23.1...
10:44:03 AM: Downloading https://nodejs.org/dist/v10.23.1/node-v10.23.1-linux-x64.tar.xz...
10:44:03 AM: Computing checksum with sha256sum
10:44:03 AM: Checksums matched!
10:44:06 AM: Now using node v10.23.1 (npm v6.14.10)
10:44:06 AM: Started restoring cached build plugins
10:44:06 AM: Finished restoring cached build plugins
10:44:06 AM: Attempting ruby version 2.6.2, read from environment
10:44:08 AM: Using ruby version 2.6.2
10:44:08 AM: Using PHP version 5.6
10:44:08 AM: Started restoring cached node modules
10:44:08 AM: Finished restoring cached node modules
10:44:08 AM: Installing NPM modules using NPM version 6.14.10
10:45:23 AM: > sharp@0.27.0 install /opt/build/repo/node_modules/gatsby-plugin-sharp/node_modules/sharp
10:45:23 AM: > (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
10:45:25 AM: info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.10.5/libvips-8.10.5-linux-x64.tar.br
10:45:28 AM: > sharp@0.27.0 install /opt/build/repo/node_modules/gatsby-transformer-sharp/node_modules/sharp
10:45:28 AM: > (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
10:45:29 AM: info sharp Using cached /opt/buildhome/.npm/_libvips/libvips-8.10.5-linux-x64.tar.br
10:45:31 AM: > sharp@0.25.4 install /opt/build/repo/node_modules/sharp
10:45:31 AM: > (node install/libvips && node install/dll-copy && prebuild-install --runtime=napi) || (node-gyp rebuild && node install/dll-copy)
10:45:32 AM: info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.9.1/libvips-8.9.1-linux-x64.tar.gz
10:45:34 AM: > puppeteer@3.3.0 install /opt/build/repo/node_modules/puppeteer
10:45:34 AM: > node install.js
10:45:43 AM: Chromium (756035) downloaded to /opt/build/repo/node_modules/puppeteer/.local-chromium/linux-756035
10:45:43 AM: > husky@4.3.7 install /opt/build/repo/node_modules/husky
10:45:43 AM: > node husky install
10:45:43 AM: husky > Setting up git hooks
10:45:44 AM: CI detected, skipping Git hooks installation.
10:45:44 AM: husky > Done
10:45:44 AM: > core-js@2.6.12 postinstall /opt/build/repo/node_modules/core-js
10:45:44 AM: > node -e "try{require('./postinstall')}catch(e){}"
10:45:44 AM: > core-js-pure@3.8.2 postinstall /opt/build/repo/node_modules/core-js-pure
10:45:44 AM: > node -e "try{require('./postinstall')}catch(e){}"
10:45:44 AM: > ejs@2.7.4 postinstall /opt/build/repo/node_modules/ejs
10:45:44 AM: > node ./postinstall.js
10:45:44 AM: > core-js@3.8.2 postinstall /opt/build/repo/node_modules/gatsby/node_modules/core-js
10:45:44 AM: > node -e "try{require('./postinstall')}catch(e){}"
10:45:45 AM: > @react-spring/core@9.0.0-rc.3 postinstall /opt/build/repo/node_modules/@react-spring/core
10:45:45 AM: > node -e "console.log('\u001b[35m\u001b[1mEnjoy react-spring? You can now donate to our open collective:\u001b[22m\u001b[39m\n > \u001b[34mhttps://opencollective.com/react-spring/donate\u001b[0m')"
10:45:45 AM: Enjoy react-spring? You can now donate to our open collective:
10:45:45 AM:  > https://opencollective.com/react-spring/donate
10:45:45 AM: > spawn-sync@1.0.15 postinstall /opt/build/repo/node_modules/spawn-sync
10:45:45 AM: > node postinstall
10:45:46 AM: > gatsby-telemetry@1.8.1 postinstall /opt/build/repo/node_modules/gatsby-plugin-sharp/node_modules/gatsby-telemetry
10:45:46 AM: > node src/postinstall.js || true
10:45:46 AM: > gatsby-telemetry@1.8.1 postinstall /opt/build/repo/node_modules/gatsby-telemetry
10:45:46 AM: > node src/postinstall.js || true
10:45:46 AM: > mozjpeg@7.0.0 postinstall /opt/build/repo/node_modules/mozjpeg
10:45:46 AM: > node lib/install.js
10:45:46 AM:   ✔ mozjpeg pre-build test passed successfully
10:45:46 AM: > pngquant-bin@6.0.0 postinstall /opt/build/repo/node_modules/pngquant-bin
10:45:46 AM: > node lib/install.js
10:45:47 AM:   ✔ pngquant pre-build test passed successfully
10:45:47 AM: > gatsby-cli@2.17.1 postinstall /opt/build/repo/node_modules/gatsby/node_modules/gatsby-cli
10:45:47 AM: > node scripts/postinstall.js
10:45:47 AM: > gatsby@2.30.2 postinstall /opt/build/repo/node_modules/gatsby
10:45:47 AM: > node scripts/postinstall.js
10:45:47 AM: > husky@4.3.7 postinstall /opt/build/repo/node_modules/husky
10:45:47 AM: > opencollective-postinstall || exit 0
10:45:48 AM: > cisco--project-workplace-2020@0.1.0 postinstall /opt/build/repo
10:45:48 AM: > node tools/reactspringfix.js
10:45:53 AM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/fsevents):
10:45:53 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
10:45:53 AM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules/mocha/node_modules/fsevents):
10:45:53 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
10:45:53 AM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.1 (node_modules/jest-haste-map/node_modules/fsevents):
10:45:53 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
10:45:53 AM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.1 (node_modules/chokidar/node_modules/fsevents):
10:45:53 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
10:45:53 AM: added 3118 packages from 1474 contributors and audited 3126 packages in 103.337s
10:45:57 AM: 189 packages are looking for funding
10:45:57 AM:   run `npm fund` for details
10:45:57 AM: found 10 vulnerabilities (1 low, 9 high)
10:45:57 AM:   run `npm audit fix` to fix them, or `npm audit` for details
10:45:57 AM: NPM modules installed
10:45:58 AM: Started restoring cached go cache
10:45:58 AM: Finished restoring cached go cache
10:45:58 AM: Installing Go version 1.12
10:46:04 AM: unset GOOS;
10:46:04 AM: unset GOARCH;
10:46:04 AM: export GOROOT='/opt/buildhome/.gimme_cache/versions/go1.12.linux.amd64';
10:46:04 AM: export PATH="/opt/buildhome/.gimme_cache/versions/go1.12.linux.amd64/bin:${PATH}";
10:46:04 AM: go version >&2;
10:46:04 AM: export GIMME_ENV="/opt/buildhome/.gimme_cache/env/go1.12.linux.amd64.env"
10:46:04 AM: go version go1.12 linux/amd64
10:46:04 AM: Installing missing commands
10:46:04 AM: Verify run directory
10:46:06 AM: ​
10:46:06 AM: ────────────────────────────────────────────────────────────────
10:46:06 AM:   Netlify Build                                                 
10:46:06 AM: ────────────────────────────────────────────────────────────────
10:46:06 AM: ​
10:46:06 AM: ❯ Version
10:46:06 AM:   @netlify/build 8.0.5
10:46:06 AM: ​
10:46:06 AM: ❯ Flags
10:46:06 AM:   deployId: 600163d8a1262e0afdc70c62
10:46:06 AM:   mode: buildbot
10:46:06 AM: ​
10:46:06 AM: ❯ Current directory
10:46:06 AM:   /opt/build/repo
10:46:06 AM: ​
10:46:06 AM: ❯ Config file
10:46:06 AM:   /opt/build/repo/netlify.toml
10:46:06 AM: ​
10:46:06 AM: ❯ Context
10:46:06 AM:   deploy-preview
10:46:06 AM: ​
10:46:06 AM: ❯ Installing plugins
10:46:06 AM:    - netlify-plugin-gatsby-cache@0.3.0
10:46:07 AM: ​
10:46:07 AM: ❯ Loading plugins
10:46:07 AM:    - netlify-plugin-gatsby-cache@0.3.0 from netlify.toml
10:46:08 AM: ​
10:46:08 AM: ────────────────────────────────────────────────────────────────
10:46:08 AM:   1. onPreBuild command from netlify-plugin-gatsby-cache        
10:46:08 AM: ────────────────────────────────────────────────────────────────
10:46:08 AM: ​
10:46:09 AM: No Gatsby cache found. Building fresh.
10:46:09 AM: ​
10:46:09 AM: (netlify-plugin-gatsby-cache onPreBuild completed in 233ms)
10:46:09 AM: ​
10:46:09 AM: ────────────────────────────────────────────────────────────────
10:46:09 AM:   2. Build command from Netlify app                             
10:46:09 AM: ────────────────────────────────────────────────────────────────
10:46:09 AM: ​
10:46:09 AM: $ gatsby build
10:46:13 AM: info The following flags are active:
10:46:13 AM: - PRESERVE_WEBPACK_CACHE · (Umbrella Issue (​https://gatsby.dev/cache-clearing-feedback​)) · Don't delete webpack's cache when changing gatsby-node.js & gatsby-config.js files.
10:46:13 AM: - PRESERVE_FILE_DOWNLOAD_CACHE · (Umbrella Issue (​https://gatsby.dev/cache-clearing-feedback​)) · Don't delete the downloaded files cache when changing gatsby-node.js & gatsby-config.js files.
10:46:13 AM: - PARALLEL_SOURCING · EXPERIMENTAL · (Umbrella Issue (​https://gatsby.dev/parallel-sourcing-feedback​)) · Run all source plugins at the same time instead of serially. For sites with multiple source plugins, this can speedup sourcing and transforming considerably.
10:46:13 AM: There are 3 other flags available that you might be interested in:
10:46:13 AM: - FAST_DEV · Enable all experiments aimed at improving develop server start time
10:46:13 AM: - DEV_SSR · (Umbrella Issue (​https://gatsby.dev/dev-ssr-feedback​)) · Server Side Render (SSR) pages on full reloads during develop. Helps you detect SSR bugs and fix them without needing to do full builds.
10:46:13 AM: - FAST_REFRESH · (Umbrella Issue (​https://gatsby.dev/fast-refresh-feedback​)) · Use React Fast Refresh instead of the legacy react-hot-loader for instantaneous feedback in your development server. Recommended for versions of React >= 17.0.
10:46:13 AM: success open and validate gatsby-configs - 0.091s
10:46:14 AM: success load plugins - 1.374s
10:46:15 AM: success onPreInit - 0.071s
10:46:15 AM: success delete html and css files from previous builds - 0.005s
10:46:15 AM: success initialize cache - 0.008s
10:46:15 AM: success copy gatsby files - 0.086s
10:46:15 AM: success onPreBootstrap - 0.021s
10:46:15 AM: success createSchemaCustomization - 0.020s
10:46:16 AM: success Contentful: Fetch data (osq47g2esuw5-master) - 1.407s
10:46:17 AM: info Updated entries 1014
10:46:17 AM: info Deleted entries 0
10:46:17 AM: info Updated assets 618
10:46:17 AM: info Deleted assets 0
10:46:17 AM: success Contentful: Proccess data (osq47g2esuw5-master) - 0.380s
10:46:17 AM: info Creating 29 Contentful Workspace nodes
10:46:17 AM: info Creating 37 Contentful Product nodes
10:46:17 AM: info Creating 126 Contentful Feature nodes
10:46:17 AM: info Creating 35 Contentful Hotspot Image nodes
10:46:17 AM: info Creating 31 Contentful Product Bundle nodes
10:46:17 AM: info Creating 53 Contentful Hotspot nodes
10:46:17 AM: info Creating 10 Contentful Device nodes
10:46:17 AM: info Creating 7 Contentful Workspace Category nodes
10:46:17 AM: info Creating 21 Contentful Workspace Sub Category nodes
10:46:17 AM: info Creating 11 Contentful Product Bundle Quantifier nodes
10:46:17 AM: info Creating 108 Contentful Device Section nodes
10:46:17 AM: info Creating 28 Contentful Device Room nodes
10:46:17 AM: info Creating 26 Contentful Page nodes
10:46:17 AM: info Creating 1 Contentful Room Experience Item nodes
10:46:17 AM: info Creating 48 Contentful Room Experience Subsection nodes
10:46:17 AM: info Creating 30 Contentful Room Experience nodes
10:46:17 AM: info Creating 35 Contentful Download File nodes
10:46:17 AM: info Creating 16 Contentful Download Reference nodes
10:46:17 AM: info Creating 20 Contentful Product Mount nodes
10:46:17 AM: info Creating 27 Contentful Product Mount Price nodes
10:46:17 AM: info Creating 23 Contentful Article nodes
10:46:17 AM: info Creating 13 Contentful Article Hero nodes
10:46:17 AM: info Creating 47 Contentful Article Body nodes
10:46:17 AM: info Creating 7 Contentful Article Gallery nodes
10:46:17 AM: info Creating 6 Contentful Article Paralax nodes
10:46:17 AM: info Creating 26 Contentful Experience nodes
10:46:17 AM: info Creating 103 Contentful Image nodes
10:46:18 AM: info Creating 1 Contentful Article Table nodes
10:46:18 AM: info Creating 40 Contentful Button nodes
10:46:18 AM: info Creating 22 Contentful Checklist nodes
10:46:18 AM: info Creating 1 Contentful Mux Video nodes
10:46:18 AM: info Creating 4 Contentful Simple Article nodes
10:46:18 AM: info Creating 5 Contentful Deployment Section nodes
10:46:18 AM: info Creating 15 Contentful Tag nodes
10:46:18 AM: info Creating 1 Contentful Product Collection nodes
10:46:18 AM: info Creating 1 Contentful RichText Definition nodes
10:46:18 AM: info Creating 618 Contentful asset nodes
10:46:18 AM: success Contentful: Create nodes (osq47g2esuw5-master) - 1.011s
10:46:18 AM: success Checking for changed pages - 0.000s
10:46:18 AM: success source and transform nodes - 3.019s
10:46:24 AM: success building schema - 6.128s
10:46:24 AM: info Total nodes: 2541, SitePage nodes: 104 (use --verbose for breakdown)
10:46:24 AM: success createPages - 0.260s
10:46:24 AM: success Checking for changed pages - 0.000s
10:46:24 AM: success createPagesStatefully - 0.140s
10:46:24 AM: success update schema - 0.117s
10:46:24 AM: success onPreExtractQueries - 0.002s
10:46:26 AM: success extract queries from components - 1.413s
10:46:26 AM: success write out redirect data - 0.006s
10:46:26 AM: vips_value_hash: no case for NULL
10:46:26 AM:    type 64, gchararray
10:46:26 AM:    generic 55, GParamString
10:46:26 AM: vips_value_hash: no case for 0.000000
10:46:26 AM:    type 60, gdouble
10:46:26 AM:    generic 109, GParamDouble
10:46:26 AM: vips_value_hash: no case for FALSE
10:46:26 AM:    type 20, gboolean
10:46:26 AM:    generic 79, GParamBoolean
10:46:26 AM: vips_value_hash: no case for ((VipsAccess) VIPS_ACCESS_RANDOM)
10:46:26 AM:    type 50357248, VipsAccess
10:46:26 AM:    generic 81, GParamEnum
10:46:26 AM: vips_value_hash: no case for FALSE
10:46:26 AM:    type 20, gboolean
10:46:26 AM:    generic 79, GParamBoolean
10:46:27 AM: ​
10:46:27 AM: ────────────────────────────────────────────────────────────────
10:46:27 AM:   "build.command" failed                                        
10:46:27 AM: ────────────────────────────────────────────────────────────────
10:46:27 AM: ​
10:46:27 AM:   Error message
10:46:27 AM:   Command was killed with SIGSEGV (Segmentation fault): gatsby build
10:46:27 AM: ​
10:46:27 AM:   Error location
10:46:27 AM:   In Build command from Netlify app:
10:46:27 AM:   gatsby build
10:46:27 AM: ​
10:46:27 AM:   Resolved config
10:46:27 AM:   build:
10:46:27 AM:     command: gatsby build
10:46:27 AM:     commandOrigin: ui
10:46:27 AM:     environment:
10:46:27 AM:       - CONTENTFUL_ACCESS_TOKEN
10:46:27 AM:       - CONTENTFUL_SPACE_ID
10:46:27 AM:       - GATSBY_COOKIE_WARNING
10:46:27 AM:       - GATSBY_FEEDBACK_BUTTON
10:46:27 AM:       - GATSBY_FORM_AUTOFILL
10:46:27 AM:       - GATSBY_FORM_NAME
10:46:27 AM:       - GATSBY_FORM_REDIRECT
10:46:27 AM:       - GATSBY_FORM_SUBMISSION_URL
10:46:27 AM:       - GATSBY_HEADER_FOOTER
10:46:27 AM:       - GATSBY_LOCAL_STORAGE_KEY
10:46:27 AM:       - GATSBY_QUOTE_BUTTONS
10:46:27 AM:       - GATSBY_SEO_INSPECTOR
10:46:27 AM:       - GA_TRACKING_ID
10:46:27 AM:       - NODE_ENV
10:46:27 AM:       - POSTMARK_TOKEN
10:46:27 AM:       - RENDER_PREVIEW_PAGES
10:46:27 AM:       - RENDER_STANDALONE_COMPONENTS
10:46:27 AM:       - REVIEW_ID
10:46:27 AM:       - ROBOTS
10:46:27 AM:       - SITE_URL
10:46:27 AM:     functions: /opt/build/repo/functions
10:46:27 AM:     publish: /opt/build/repo/public
10:46:27 AM:   plugins:
10:46:27 AM:     - inputs: {}
10:46:27 AM:       origin: config
10:46:27 AM:       package: netlify-plugin-gatsby-cache
10:46:27 AM: Caching artifacts
10:46:27 AM: Started saving node modules
10:46:27 AM: Finished saving node modules
10:46:27 AM: Started saving build plugins
10:46:27 AM: Finished saving build plugins
10:46:27 AM: Started saving pip cache
10:46:27 AM: Finished saving pip cache
10:46:27 AM: Started saving emacs cask dependencies
10:46:28 AM: Finished saving emacs cask dependencies
10:46:28 AM: Started saving maven dependencies
10:46:28 AM: Finished saving maven dependencies
10:46:28 AM: Started saving boot dependencies
10:46:28 AM: Finished saving boot dependencies
10:46:28 AM: Started saving rust rustup cache
10:46:28 AM: Finished saving rust rustup cache
10:46:28 AM: Started saving rust cargo bin cache
10:46:28 AM: Finished saving rust cargo bin cache
10:46:28 AM: Started saving go dependencies
10:46:30 AM: Finished saving go dependencies
10:46:33 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
10:46:33 AM: Failing build: Failed to build site
10:46:34 AM: Failed during stage 'building site': Build script returned non-zero exit code: 2
10:46:34 AM: Finished processing build request in 2m39.230682002s

edit: related?: https://stackoverflow.com/questions/65012190/gatsby-failed-build-on-netlify

vladar commented 3 years ago

We've bumped a version of sharp recently and this is likely the cause of the problem (other report, probably with a different cause: #28203).

I have several ideas about it. One possible reason is that you have multiple conflicting versions of sharp. See the log:

10:45:28 AM: > sharp@0.27.0 install /opt/build/repo/node_modules/gatsby-transformer-sharp/node_modules/sharp
10:45:28 AM: > (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
10:45:29 AM: info sharp Using cached /opt/buildhome/.npm/_libvips/libvips-8.10.5-linux-x64.tar.br
10:45:31 AM: > sharp@0.25.4 install /opt/build/repo/node_modules/sharp
10:45:31 AM: > (node install/libvips && node install/dll-copy && prebuild-install --runtime=napi) || (node-gyp rebuild && node install/dll-copy)

It installs both sharp@0.27.0 and sharp@0.25.4. Try running yarn why sharp to figure out what packages have older sharp in their deps and try upgrading those. Or put sharp: 0.27.0 in yarn.resolutions

Also, previously we've seen cases when globally installed version of libvips was conflicting with local sharp. So another thing to try:

rm -rf node_modules &&
SHARP_IGNORE_GLOBAL_LIBVIPS=true yarn
martinhj commented 3 years ago

Yes, got different versions here:

❯ npm list sharp
cisco--project-workplace-2020@0.1.0 /Users/martinhj/projects/cisco--project-workplace-2020
├─┬ gatsby-plugin-manifest@2.4.28
│ └── sharp@0.25.4 
├─┬ gatsby-plugin-sharp@2.12.1
│ └── sharp@0.27.0 
└─┬ gatsby-transformer-sharp@2.10.1
  └── sharp@0.27.0 

Going to upgrade plugin-manifest and build a test on netlify.

martinhj commented 3 years ago

Upgrading gatsby-plugin-mainfest together with gatsby-plugin-sharp and gatsby-gransformer-sharp solves the problem. The build now completes successfully also on netlify

vladar commented 3 years ago

We're marking this issue as answered and closing it for now but please feel free to continue this discussion. We hope we managed to help and thank you for using Gatsby! 💜