Builds constantly killed with exit code 137

Ever since we moved the builds for our site, wttech-hub, to the focal image, we’ve been unable to build it. There were no changes to the code of the site between the last successful build and the ones that are now failing.
Each build ends with the following output

4:38:51 PM: Killed
4:38:51 PM: error Command failed with exit code 137. (https://ntl.fyi/exit-code-137)

We’ve read that this is most likely caused by memory issues and gone over [Support Guide] Making sure your builds use appropriate resources for Netlify's build system

We’ve tried renaming our build command from yarn build to yarn assemble, as we’ve read naming the script build could cause problems. This wasn’t it.

The site uses Gatsby. We’ve read 5 Optimizations to Get Faster Gatsby Builds Today which suggests that netlify-plugin-gatsby-cached plugin be used. This is something we already have in our build, but, if we’re reading it correctly, the build output implies that cached dependencies aren’t found.

It seems that the plugin has been deprecated since we introduced it. It appears to have been replaced by @netlify/plugin-gatsby - npm (Essential Gatsby). The README for plugin-gatsby implies that it is installed by default on all gatsby-based Netlify builds. The README also mentions that we should make sure to uninstall gatsby-plugin-netlify-cache before using the new plugin.

  • Essential Gatsby includes functionality from the Gatsby Cache build plugin. If you already have the Gatsby Cache plugin installed on your Netlify site, you should remove it before installing this plugin.
  • Essential Gatsby is not compatible with the Gatsby community plugin gatsby-plugin-netlify-cache.

The Netlify documentation describes the steps required to remove a plugin, but we don’t see anything under Plugins when we inspect the site, even though the plugin had supposedly been used in the past. Is it because only plugins installed manually are visible in that interface?

In our case, the now deprecated plugin was added via netlify.toml

[[plugins]]
package = "netlify-plugin-gatsby-cache"

Do you reckon those plugins could be clashing? Or does this look like a red herring and the root cause should be sought elsewhere?

Here’s an example of a full build log (with repo URL replaced)

4:26:11 PM: Build ready to start
4:26:24 PM: build-image version: 4c0c1cadee6a31c9bb8d824514030009c4c05c6a (focal)
4:26:24 PM: build-image tag: v4.15.0
4:26:24 PM: buildbot version: e6d57a43d406fdcaf8ee2df93f280acce2e07259
4:26:24 PM: Fetching cached dependencies
4:26:24 PM: Failed to fetch cache, continuing with build
4:26:24 PM: Starting to prepare the repo for build
4:26:26 PM: No cached dependencies found. Cloning fresh repo
4:26:26 PM: git clone ssh://git.example.com/blog.git
4:26:57 PM: Preparing Git Reference refs/heads/main
4:27:01 PM: Parsing package.json dependencies
4:27:02 PM: ​❯ Initial build environmentbaseRelDir: truebranch: maincontext: productioncwd: /opt/build/repofeatureFlags: []mode: buildbotrepositoryRoot: /opt/build/repositeId: bd81a536-600a-422b-af95-ebb766757d74​❯ UI build settingsbaseRelDir: truebuild:  command: yarn assemble  environment:    - ALGOLIA_ADMIN_KEY    - GATSBY_ALGOLIA_APP_ID    - GATSBY_ALGOLIA_SEARCH_KEY    - NETLIFY_BUILD_DEBUG  publish: public​❯ Resolved build environmentbranch: mainbuildDir: /opt/build/repoconfigPath: /opt/build/repo/netlify.tomlcontext: productionenv: []​❯ Resolved configbuild:  command: yarn assemble  commandOrigin: ui  environment:    - ALGOLIA_ADMIN_KEY    - GATSBY_ALGOLIA_APP_ID    - GATSBY_ALGOLIA_SEARCH_KEY    - NETLIFY_BUILD_DEBUG    - YARN_VERSION    - YARN_FLAGS  publish: /opt/build/repo/public  publishOrigin: configfunctionsDirectory: /opt/build/repo/functionsheaders:  - for: /*    values:      Referrer-Policy: no-referrer-when-downgrade      X-Content-Type-Options: nosniff      X-Frame-Options: SAMEORIGIN      X-XSS-Protection: 1; mode=blockheadersOrigin: configplugins:  - inputs: {}    origin: config    package: netlify-plugin-gatsby-cacheredirects:  - force: true    from: /welcome    status: 301    to: /redirectsOrigin: config
4:27:02 PM: Section completed: initializing
4:27:02 PM: Starting build script
4:27:02 PM: Installing dependencies
4:27:02 PM: Python version set to 2.7
4:27:03 PM: Downloading and installing node v12.18.0...
4:27:03 PM: Downloading https://nodejs.org/dist/v12.18.0/node-v12.18.0-linux-x64.tar.xz...
4:27:03 PM: Computing checksum with sha256sum
4:27:03 PM: Checksums matched!
4:27:05 PM: Now using node v12.18.0 (npm v6.14.4)
4:27:06 PM: Started restoring cached build plugins
4:27:06 PM: Finished restoring cached build plugins
4:27:06 PM: Attempting ruby version 2.7.1, read from environment
4:27:06 PM: Required ruby-2.7.1 is not installed - installing.
4:27:06 PM: Searching for binary rubies, this might take some time.
4:27:06 PM: Found remote file https://rvm_io.global.ssl.fastly.net/binaries/ubuntu/20.04/x86_64/ruby-2.7.1.tar.bz2
4:27:06 PM: Checking requirements for ubuntu.
4:27:07 PM: Requirements installation successful.
4:27:07 PM: ruby-2.7.1 - #configure
4:27:07 PM: ruby-2.7.1 - #download
4:27:07 PM: ruby-2.7.1 - #validate archive
4:27:10 PM: ruby-2.7.1 - #extract
4:27:12 PM: ruby-2.7.1 - #validate binary
4:27:13 PM: ruby-2.7.1 - #setup
4:27:13 PM: ruby-2.7.1 - #gemset created /opt/buildhome/.rvm/gems/ruby-2.7.1@global
4:27:13 PM: ruby-2.7.1 - #importing gemset /opt/buildhome/.rvm/gemsets/global.gems........................................
4:27:13 PM: ruby-2.7.1 - #generating global wrappers........
4:27:13 PM: ruby-2.7.1 - #gemset created /opt/buildhome/.rvm/gems/ruby-2.7.1
4:27:13 PM: ruby-2.7.1 - #importing gemsetfile /opt/buildhome/.rvm/gemsets/default.gems evaluated to empty gem list
4:27:14 PM: ruby-2.7.1 - #generating default wrappers........
4:27:14 PM: Using /opt/buildhome/.rvm/gems/ruby-2.7.1
4:27:14 PM: Using ruby version 2.7.1
4:27:14 PM: Using PHP version 8.0
4:27:14 PM: Started restoring cached yarn cache
4:27:14 PM: Finished restoring cached yarn cache
4:27:15 PM: Found yarn version (1.22.19) that doesn't match expected (1.9.4)up to date in 0.016s
4:27:15 PM: Installing yarn at version 1.9.4
4:27:15 PM: Installing Yarn!
4:27:15 PM: > Downloading tarball...
4:27:15 PM: [1/2]: https://yarnpkg.com/downloads/1.9.4/yarn-v1.9.4.tar.gz --> /tmp/yarn.tar.gz.Rmgyi5ClO2
4:27:15 PM:   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
4:27:15 PM:                                  Dload  Upload   Total   Spent    Left  Speed
4:27:15 PM:   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
4:27:15 PM: 100    77  100    77    0     0    461      0 --:--:-- --:--:-- --:--:--   461
4:27:15 PM: 100    91  100    91    0     0    382      0 --:--:-- --:--:-- --:--:--   382
4:27:15 PM:   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
4:27:16 PM:   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
4:27:16 PM: 100  915k  100  915k    0     0  1003k      0 --:--:-- --:--:-- --:--:-- 1787k
4:27:16 PM: [2/2]: https://yarnpkg.com/downloads/1.9.4/yarn-v1.9.4.tar.gz.asc --> /tmp/yarn.tar.gz.Rmgyi5ClO2.asc
4:27:16 PM:   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
4:27:16 PM:                                  Dload  Upload   Total   Spent    Left  Speed
4:27:16 PM:   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
4:27:16 PM: 100    81  100    81    0     0    810      0 --:--:-- --:--:-- --:--:--   810
4:27:16 PM: 100    94  100    94    0     0    824      0 --:--:-- --:--:-- --:--:--   824
4:27:16 PM:   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
4:27:16 PM: 100   832  100   832    0     0   3395      0 --:--:-- --:--:-- --:--:--  3395
4:27:16 PM: > Verifying integrity...
4:27:16 PM: gpg: Signature made Fri 03 Aug 2018 07:53:36 PM UTC
4:27:16 PM: gpg:                using RSA key E21930C4D0A4AA4618581F7AE074D16EB6FF4DE3
4:27:16 PM: gpg: Good signature from "Yarn Packaging <yarn@dan.cx>" [unknown]
4:27:16 PM: gpg: Note: This key has expired!
4:27:16 PM: Primary key fingerprint: 72EC F46A 56B4 AD39 C907  BBB7 1646 B01B 86E5 0310
4:27:16 PM:      Subkey fingerprint: E219 30C4 D0A4 AA46 1858  1F7A E074 D16E B6FF 4DE3
4:27:16 PM: > GPG signature looks good
4:27:16 PM: > Extracting to ~/.yarn...
4:27:16 PM: > Adding to $PATH...
4:27:16 PM: > Successfully installed Yarn 1.9.4! Please open another terminal where the `yarn` command will now be available.
4:27:16 PM: No yarn workspaces detected
4:27:16 PM: Started restoring cached node modules
4:27:16 PM: Finished restoring cached node modules
4:27:16 PM: Installing NPM modules using Yarn version 1.9.4
4:27:17 PM: yarn install v1.9.4
4:27:17 PM: [1/4] Resolving packages...
4:27:17 PM: [2/4] Fetching packages...
4:27:17 PM: (node:3315) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
4:27:35 PM: info fsevents@2.1.3: The platform "linux" is incompatible with this module.
4:27:35 PM: info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
4:27:35 PM: info fsevents@1.2.12: The platform "linux" is incompatible with this module.
4:27:35 PM: info "fsevents@1.2.12" is an optional dependency and failed compatibility check. Excluding it from installation.
4:27:35 PM: [3/4] Linking dependencies...
4:27:35 PM: warning "gatsby > @pmmmwh/react-refresh-webpack-plugin@0.2.0" has unmet peer dependency "sockjs-client@^1.4.0".
4:27:35 PM: warning "gatsby > react-hot-loader@4.12.20" has unmet peer dependency "@types/react@^15.0.0 || ^16.0.0".
4:27:35 PM: warning "gatsby > @typescript-eslint/eslint-plugin > tsutils@3.17.1" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
4:27:35 PM: warning "gatsby > gatsby-cli > ink@2.7.1" has unmet peer dependency "@types/react@>=16.8.0".
4:27:35 PM: warning "gatsby > gatsby-cli > gatsby-recipes > ws@7.2.3" has unmet peer dependency "bufferutil@^4.0.1".
4:27:35 PM: warning "gatsby > gatsby-cli > gatsby-recipes > ws@7.2.3" has unmet peer dependency "utf-8-validate@^5.0.2".
4:27:35 PM: warning "gatsby-plugin-netlify > webpack-assets-manifest@3.1.1" has unmet peer dependency "webpack@>=4.4.0".
4:27:35 PM: warning "gatsby-plugin-next-seo > schema-dts@0.4.5" has unmet peer dependency "typescript@^3.1.6".
4:27:35 PM: warning "gatsby-plugin-sass > sass-loader@7.3.1" has unmet peer dependency "webpack@^3.0.0 || ^4.0.0".
4:27:35 PM: warning "gatsby-remark-fenced-divs > remark-fenced-divs@1.1.4" has unmet peer dependency "remark@<13".
4:27:35 PM: warning " > lodash-webpack-plugin@0.11.5" has unmet peer dependency "webpack@^2.0.0 || ^3.0.0 || ^4.0.0".
4:27:35 PM: warning "react-instantsearch-dom > algoliasearch-helper@3.1.1" has unmet peer dependency "algoliasearch@>= 3.1 < 5".
4:27:52 PM: [4/4] Building fresh packages...
4:28:08 PM: Done in 51.43s.
4:28:08 PM: NPM modules installed using Yarn
4:28:08 PM: Started restoring cached go cache
4:28:08 PM: Finished restoring cached go cache
4:28:08 PM: Installing Go version 1.14.4 (requested 1.14.4)
4:28:12 PM: unset GOOS;
4:28:12 PM: unset GOARCH;
4:28:12 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.14.4.linux.amd64';
4:28:12 PM: export PATH="/opt/buildhome/.gimme/versions/go1.14.4.linux.amd64/bin:${PATH}";
4:28:12 PM: go version >&2;
4:28:12 PM: export GIMME_ENV="/opt/buildhome/.gimme/env/go1.14.4.linux.amd64.env"
4:28:12 PM: go version go1.14.4 linux/amd64
4:28:12 PM: Detected 2 framework(s)
4:28:12 PM: "gatsby" at version "2.20.29"
4:28:12 PM: "parcel" at version "1.12.4"
4:28:12 PM: Installing missing commands
4:28:12 PM: Verify run directory
4:28:14 PM: ​
4:28:14 PM: ────────────────────────────────────────────────────────────────
4:28:14 PM:   Netlify Build                                                 
4:28:14 PM: ────────────────────────────────────────────────────────────────
4:28:14 PM: ​
4:28:14 PM: ❯ Version
4:28:14 PM:   @netlify/build 29.0.3
4:28:14 PM: ​
4:28:14 PM: ❯ Flags
4:28:14 PM:   apiHost: api.netlify.com
4:28:14 PM:   baseRelDir: true
4:28:14 PM:   branch: main
4:28:14 PM:   buildId: 639748133860053884f3e747
4:28:14 PM:   buildbotServerSocket: /tmp/netlify-buildbot-socket
4:28:14 PM:   cacheDir: /opt/build/cache
4:28:14 PM:   cachedConfigPath: /tmp/netlify_config.json
4:28:14 PM:   context: production
4:28:14 PM:   cwd: /opt/build/repo
4:28:14 PM:   deployId: 639748133860053884f3e749
4:28:14 PM:   edgeFunctionsDistDir: /tmp/edge-639748133860053884f3e749
4:28:14 PM:   featureFlags:
4:28:14 PM:     - edge_functions_cache_cli
4:28:14 PM:     - edge_functions_system_logger
4:28:14 PM:     - plugins_break_builds_with_unsupported_plugin_versions
4:28:14 PM:   framework: unknown
4:28:14 PM:   functionsDistDir: /tmp/zisi-639748133860053884f3e749
4:28:14 PM:   mode: buildbot
4:28:14 PM:   nodePath: /opt/buildhome/.nvm/versions/node/v12.18.0/bin/node
4:28:14 PM:   repositoryRoot: /opt/build/repo
4:28:14 PM:   saveConfig: true
4:28:14 PM:   sendStatus: true
4:28:14 PM:   siteId: bd81a536-600a-422b-af95-ebb766757d74
4:28:14 PM:   statsd:
4:28:14 PM:     host: 10.65.24.144
4:28:14 PM:     port: 8125
4:28:14 PM:   systemLogFile: 3
4:28:14 PM:   testOpts:
4:28:14 PM:     silentLingeringProcesses: ''
4:28:14 PM: ​
4:28:14 PM: ❯ Current directory
4:28:14 PM:   /opt/build/repo
4:28:14 PM: ​
4:28:14 PM: ❯ Config file
4:28:14 PM:   /opt/build/repo/netlify.toml
4:28:14 PM: ​
4:28:14 PM: ❯ Resolved config
4:28:14 PM:   build:
4:28:14 PM:     command: yarn assemble
4:28:14 PM:     commandOrigin: ui
4:28:14 PM:     environment:
4:28:14 PM:       - ALGOLIA_ADMIN_KEY
4:28:14 PM:       - GATSBY_ALGOLIA_APP_ID
4:28:14 PM:       - GATSBY_ALGOLIA_SEARCH_KEY
4:28:14 PM:       - NETLIFY_BUILD_DEBUG
4:28:14 PM:       - YARN_VERSION
4:28:14 PM:       - YARN_FLAGS
4:28:14 PM:     publish: /opt/build/repo/public
4:28:14 PM:     publishOrigin: config
4:28:14 PM:   functionsDirectory: /opt/build/repo/functions
4:28:14 PM:   headers:
4:28:14 PM:     - for: /*      values:        Referrer-Policy: no-referrer-when-downgrade        X-Content-Type-Options: nosniff        X-Frame-Options: SAMEORIGIN        X-XSS-Protection: 1; mode=block  headersOrigin: config  plugins:    - inputs: {}      origin: config      package: netlify-plugin-gatsby-cache  redirects:    - force: true      from: /welcome      status: 301      to: /  redirectsOrigin: config​
4:28:14 PM: ❯ Context
4:28:14 PM:   production
4:28:14 PM: ​
4:28:14 PM: ❯ Available plugins
4:28:14 PM:    - @algolia/netlify-plugin-crawler@1.0.0
4:28:14 PM:    - @bharathvaj/netlify-plugin-airbrake@1.0.2
4:28:14 PM:    - @chiselstrike/netlify-plugin@0.1.0
4:28:14 PM:    - @commandbar/netlify-plugin-commandbar@0.0.4
4:28:14 PM:    - @helloample/netlify-plugin-replace@1.1.4
4:28:14 PM:    - @netlify/feature-package-pilot@0.1.2
4:28:14 PM:    - @netlify/plugin-angular-universal@1.0.1
4:28:14 PM:    - @netlify/plugin-emails@0.0.28
4:28:14 PM:    - @netlify/plugin-gatsby@3.4.8
4:28:14 PM:    - @netlify/plugin-lighthouse@4.0.3
4:28:14 PM:    - @netlify/plugin-nextjs@4.29.3
4:28:14 PM:    - @netlify/plugin-sitemap@0.8.1
4:28:14 PM:    - @newrelic/netlify-plugin@1.0.1
4:28:14 PM:    - @sentry/netlify-build-plugin@1.1.1
4:28:14 PM:    - @snaplet/netlify-preview-database-plugin@2.0.0
4:28:14 PM:    - @takeshape/netlify-plugin-takeshape@1.0.0
4:28:14 PM:    - @vgs/netlify-plugin-vgs@0.0.2
4:28:14 PM:    - netlify-build-plugin-dareboost@1.2.1
4:28:14 PM:    - netlify-build-plugin-debugbear@1.0.6
4:28:14 PM:    - netlify-build-plugin-perfbeacon@1.0.3
4:28:14 PM:    - netlify-build-plugin-speedcurve@2.0.0
4:28:14 PM:    - netlify-deployment-hours-plugin@0.0.10
4:28:14 PM:    - netlify-plugin-a11y@0.0.12
4:28:14 PM:    - netlify-plugin-add-instagram@0.2.2
4:28:14 PM:    - netlify-plugin-algolia-index@0.3.0
4:28:14 PM:    - netlify-plugin-amp-server-side-rendering@1.0.2
4:28:14 PM:    - netlify-plugin-brand-guardian@1.0.1
4:28:14 PM:    - netlify-plugin-build-logger@1.0.3
4:28:14 PM:    - netlify-plugin-cache-nextjs@1.4.0
4:28:14 PM:    - netlify-plugin-cecil-cache@0.3.3
4:28:14 PM:    - netlify-plugin-checklinks@4.1.1
4:28:14 PM:    - netlify-plugin-chromium@1.1.4
4:28:14 PM:    - netlify-plugin-cloudinary@1.0.3
4:28:14 PM:    - netlify-plugin-contextual-env@0.3.0
4:28:14 PM:    - netlify-plugin-cypress@2.2.0
4:28:14 PM:    - netlify-plugin-debug-cache@1.0.4
4:28:14 PM:    - netlify-plugin-encrypted-files@0.0.5
4:28:14 PM:    - netlify-plugin-fetch-feeds@0.2.3
4:28:14 PM:    - netlify-plugin-flutter@1.1.0
4:28:14 PM:    - netlify-plugin-formspree@1.0.1
4:28:14 PM:    - netlify-plugin-gatsby-cache@0.3.0
4:28:14 PM:    - netlify-plugin-get-env-vars@1.0.0
4:28:14 PM:    - netlify-plugin-ghost-inspector@1.0.1
4:28:14 PM:    - netlify-plugin-ghost-markdown@3.1.0
4:28:14 PM:    - netlify-plugin-gmail@1.1.0
4:28:14 PM:    - netlify-plugin-gridsome-cache@1.0.3
4:28:14 PM:    - netlify-plugin-hashfiles@4.0.2
4:28:14 PM:    - netlify-plugin-html-validate@1.0.0
4:28:14 PM:    - netlify-plugin-hugo-cache-resources@0.2.1
4:28:14 PM:    - netlify-plugin-image-optim@0.4.0
4:28:14 PM:    - netlify-plugin-inline-critical-css@2.0.0
4:28:14 PM:    - netlify-plugin-inline-functions-env@1.0.8
4:28:14 PM:    - netlify-plugin-inline-source@1.0.4
4:28:14 PM:    - netlify-plugin-inngest@1.0.0
4:28:14 PM:    - netlify-plugin-is-website-vulnerable@2.0.3
4:28:14 PM:    - netlify-plugin-jekyll-cache@1.0.0
4:28:14 PM:    - netlify-plugin-js-obfuscator@1.0.20
4:28:14 PM:    - netlify-plugin-minify-html@0.3.1
4:28:14 PM:    - netlify-plugin-next-dynamic@1.0.9
4:28:14 PM:    - netlify-plugin-nimbella@2.1.0
4:28:14 PM:    - netlify-plugin-no-more-404@0.0.15
4:28:14 PM:    - netlify-plugin-nx-skip-build@0.0.7
4:28:14 PM:    - netlify-plugin-pagewatch@1.0.4
4:28:14 PM:    - netlify-plugin-playwright-cache@0.0.1
4:28:14 PM:    - netlify-plugin-prerender-spa@1.0.1
4:28:14 PM:    - netlify-plugin-prisma-provider@0.3.0
4:28:14 PM:    - netlify-plugin-pushover@0.1.1
4:28:14 PM:    - netlify-plugin-qawolf@1.2.0
4:28:14 PM:    - netlify-plugin-rss@0.0.8
4:28:14 PM:    - netlify-plugin-search-index@0.1.5
4:28:14 PM:    - netlify-plugin-snyk@1.2.0
4:28:14 PM:    - netlify-plugin-stepzen@1.0.4
4:28:14 PM:    - netlify-plugin-subfont@6.0.0
4:28:14 PM:    - netlify-plugin-submit-sitemap@0.4.0
4:28:14 PM:    - netlify-plugin-to-all-events@1.3.1
4:28:14 PM:    - netlify-plugin-use-env-in-runtime@1.2.1
4:28:14 PM:    - netlify-plugin-visual-diff@2.0.0
4:28:14 PM:    - netlify-plugin-webmentions@1.1.0
4:28:14 PM:    - netlify-purge-cloudflare-on-deploy@1.2.0
4:28:14 PM: ​
4:28:14 PM: ❯ Installing plugins
4:28:14 PM:    - netlify-plugin-gatsby-cache@0.3.0
4:28:15 PM: ​
4:28:15 PM: ❯ Loading plugins
4:28:15 PM:    - netlify-plugin-gatsby-cache@0.3.0 from netlify.toml (pinned 0.3, latest 0.3.0, expected 0.3.0, compatible 0.3.0)
4:28:16 PM: ​
4:28:16 PM: ────────────────────────────────────────────────────────────────
4:28:16 PM:   1. netlify-plugin-gatsby-cache (onPreBuild event)             
4:28:16 PM: ────────────────────────────────────────────────────────────────
4:28:16 PM: ​
4:28:16 PM: Step starting.
4:28:16 PM: Step started.
4:28:16 PM: Plugin logic started.
4:28:16 PM: No Gatsby cache found. Building fresh.
4:28:16 PM: Plugin logic ended.
4:28:16 PM: Stop closing.
4:28:16 PM: Step ended.
4:28:16 PM: Step completed.
4:28:16 PM: ​
4:28:16 PM: (netlify-plugin-gatsby-cache onPreBuild completed in 13ms)
4:28:16 PM: Build step duration: netlify-plugin-gatsby-cache onPreBuild completed in 13ms
4:28:16 PM: ​
4:28:16 PM: ────────────────────────────────────────────────────────────────
4:28:16 PM:   2. Build command from Netlify app                             
4:28:16 PM: ────────────────────────────────────────────────────────────────
4:28:16 PM: ​
4:28:16 PM: $ yarn assemble
4:28:16 PM: yarn run v1.9.4
4:28:16 PM: $ gatsby build
4:28:17 PM: Using environment config: 'production'
4:28:17 PM: success open and validate gatsby-configs - 0.054s
4:28:18 PM: success load plugins - 0.868s
4:28:18 PM: success onPreInit - 0.006s
4:28:18 PM: success delete html and css files from previous builds - 0.007s
4:28:18 PM: success initialize cache - 0.004s
4:28:18 PM: success copy gatsby files - 0.021s
4:28:18 PM: success onPreBootstrap - 0.003s
4:28:18 PM: success createSchemaCustomization - 0.020s
4:28:20 PM: success source and transform nodes - 1.638s
4:28:20 PM: success building schema - 0.316s
4:28:25 PM: warning code block or inline code language not specified in markdown. applying generic code block
4:28:29 PM: warning unable to find prism language 'log' for highlighting. applying generic code block
4:28:29 PM: warning unable to find prism language 'shellscript' for highlighting. applying generic code block
4:28:31 PM: warning unable to find prism language 'console' for highlighting. applying generic code block
4:28:32 PM: Pagination JSON created at path: /opt/build/repo/public/pagination-data/blog/page-1.json
4:28:32 PM: Pagination JSON created at path: /opt/build/repo/public/pagination-data/blog/page-2.json
4:28:32 PM: Pagination JSON created at path: /opt/build/repo/public/pagination-data/blog/page-3.json
4:28:32 PM: Pagination JSON created at path: /opt/build/repo/public/pagination-data/blog/page-4.json
4:28:32 PM: Pagination JSON created at path: /opt/build/repo/public/pagination-data/blog/page-5.json
4:28:32 PM: Pagination JSON created at path: /opt/build/repo/public/pagination-data/events/page-1.json
4:28:32 PM: Pagination JSON created at path: /opt/build/repo/public/pagination-data/blog/development/page-1.json
4:28:32 PM: Pagination JSON created at path: /opt/build/repo/public/pagination-data/blog/development/page-2.json
4:28:32 PM: success createPages - 11.793s
4:28:32 PM: success createPagesStatefully - 0.064s
4:28:32 PM: success onPreExtractQueries - 0.000s
4:28:32 PM: success update schema - 0.040s
4:28:32 PM: success extract queries from components - 0.456s
4:28:32 PM: success write out requires - 0.011s
4:28:32 PM: success write out redirect data - 0.001s
4:28:33 PM: success Build manifest and related icons - 0.106s
4:28:33 PM: success onPostBootstrap - 0.107s
4:28:33 PM: ⠀
4:28:33 PM: info bootstrap finished - 16.535 s
4:28:33 PM: ⠀
4:28:33 PM: warning Browserslist: caniuse-lite is outdated. Please run:
4:28:33 PM: npx browserslist@latest --update-db
4:28:38 PM: 
4:28:38 PM: gatsby-plugin-purgecss: Ignored  /opt/build/repo/src/styles/prismjs.css
4:28:45 PM: 
4:28:45 PM: gatsby-plugin-purgecss: Only processing  /opt/build/repo/src/components/all.scss
4:28:45 PM: 
4:28:45 PM: From:  /opt/build/repo/src/components/all.scss
4:28:45 PM:  Removed Selectors:  [
4:28:45 PM:   'address',
4:28:45 PM:   'small address',
4:28:45 PM:   '.pattern-pull-left',
4:28:45 PM:   '.pattern-pull-left::before',
4:28:45 PM:   '.data-table th.scope-row',
4:28:45 PM:   '.data-table th.scope-row p',
4:28:45 PM:   '.linearise-data-table-tablet th.scope-row',
4:28:45 PM:   '.linearise-data-table-tablet th.scope-row>p',
4:28:45 PM:   '.linearise-data-table-tablet th.scope-row>p:first-child:empty',
4:28:45 PM:   '.linearise-data-table-tablet th.scope-row>.gatsby-highlight',
4:28:45 PM:   '.linearise-data-table-tablet tfooter',
4:28:45 PM:   'th.bt-xs',
4:28:45 PM:   'td.bt-xs',
4:28:45 PM:   'th.bb-xs',
4:28:45 PM:   'td.bb-xs',
4:28:45 PM:   'th.bb-s',
4:28:45 PM:   'td.bb-s',
4:28:45 PM:   'th.ta-c',
4:28:45 PM:   'td.ta-c',
4:28:45 PM:   'th.ta-l',
4:28:45 PM:   'td.ta-l',
4:28:45 PM:   'th.ta-l-tablet',
4:28:45 PM:   'td.ta-l-tablet',
4:28:45 PM:   'th.ta-r-tablet',
4:28:45 PM:   'td.ta-r-tablet',
4:28:45 PM:   'th.bt-tablet',
4:28:45 PM:   'td.bt-tablet',
4:28:45 PM:   'th.bb-tablet',
4:28:45 PM:   'td.bb-tablet',
4:28:45 PM:   '.off-xs-1',
4:28:45 PM:   '.off-xs-2',
4:28:45 PM:   '.off-xs-3',
4:28:45 PM:   '.off-xs-4',
4:28:45 PM:   '.off-xs-5',
4:28:45 PM:   '.off-xs-6',
4:28:45 PM:   '.off-xs-7',
4:28:45 PM:   '.off-xs-8',
4:28:45 PM:   '.off-xs-9',
4:28:45 PM:   '.off-xs-10',
4:28:45 PM:   '.off-xs-11',
4:28:45 PM:   '.off-sm-0',
4:28:45 PM:   '.off-sm-2',
4:28:45 PM:   '.off-sm-3',
4:28:45 PM:   '.off-sm-4',
4:28:45 PM:   '.off-sm-5',
4:28:45 PM:   '.off-sm-6',
4:28:45 PM:   '.off-sm-7',
4:28:45 PM:   '.off-sm-8',
4:28:45 PM:   '.off-sm-9',
4:28:45 PM:   '.off-sm-10',
4:28:45 PM:   '.off-sm-11',
4:28:45 PM:   '.off-md-2',
4:28:45 PM:   '.off-md-3',
4:28:45 PM:   '.off-md-4',
4:28:45 PM:   '.off-md-5',
4:28:45 PM:   '.off-md-6',
4:28:45 PM:   '.off-md-7',
4:28:45 PM:   '.off-md-8',
4:28:45 PM:   '.off-md-9',
4:28:45 PM:   '.off-md-10',
4:28:45 PM:   '.off-md-11',
4:28:45 PM:   '.off-lg-0',
4:28:45 PM:   '.off-lg-1',
4:28:45 PM:   '.off-lg-2',
4:28:45 PM:   '.off-lg-3',
4:28:45 PM:   '.off-lg-4',
4:28:45 PM:   '.off-lg-5',
4:28:45 PM:   '.off-lg-6',
4:28:45 PM:   '.off-lg-7',
4:28:45 PM:   '.off-lg-8',
4:28:45 PM:   '.off-lg-9',
4:28:45 PM:   '.off-lg-10',
4:28:45 PM:   '.off-lg-11',
4:28:45 PM:   '.off-xl-0',
4:28:45 PM:   '.off-xl-1',
4:28:45 PM:   '.off-xl-2',
4:28:45 PM:   '.off-xl-3',
4:28:45 PM:   '.off-xl-4',
4:28:45 PM:   '.off-xl-5',
4:28:45 PM:   '.off-xl-6',
4:28:45 PM:   '.off-xl-7',
4:28:45 PM:   '.off-xl-8',
4:28:45 PM:   '.off-xl-9',
4:28:45 PM:   '.off-xl-10',
4:28:45 PM:   '.off-xl-11',
4:28:45 PM:   '.external-link-icon:after',
4:28:45 PM:   '.inline-block',
4:28:45 PM:   '.external-link.pseudo-absolute::before',
4:28:45 PM:   '.external-link.pseudo-absolute::after',
4:28:45 PM:   '.pseudo-absolute::before',
4:28:45 PM:   '.pseudo-absolute::after',
4:28:45 PM:   '.external-link.pseudo-inline-after::after',
4:28:45 PM:   '.pseudo-inline-after::after',
4:28:45 PM:   '.square-large',
4:28:45 PM:   '.card-secondary-layout.card-event .is-event-meta',
4:28:45 PM:   '.search-filters-container .search-filter-group-header',
4:28:45 PM:   '.has-text-centered',
4:28:45 PM:   '#onetrust-consent-sdk'
4:28:45 PM: ]
4:29:01 PM: success Building production JavaScript and CSS bundles - 28.506s
4:29:02 PM: success Rewriting compilation hashes - 0.000s
4:29:22 PM: success run queries - 49.871s - 360/360 7.22/s
4:38:12 PM: 
4:38:12 PM: gatsby-plugin-purgecss:
4:38:12 PM:  Previous CSS Size: 96.99 KB
4:38:12 PM:  New CSS Size: 93.74 KB (-3.35%)
4:38:12 PM:  Removed ~3.25 KB of CSS
4:38:12 PM: 
4:38:51 PM: Killed
4:38:51 PM: error Command failed with exit code 137. (https://ntl.fyi/exit-code-137)
4:38:51 PM: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
4:38:51 PM: ​
4:38:51 PM: ────────────────────────────────────────────────────────────────
4:38:51 PM:   "build.command" failed                                        
4:38:51 PM: ────────────────────────────────────────────────────────────────
4:38:51 PM: ​
4:38:51 PM:   Error message
4:38:51 PM:   Command failed with exit code 1: yarn assemble (https://ntl.fyi/exit-code-1)
4:38:51 PM: ​
4:38:51 PM:   Error location
4:38:51 PM:   In Build command from Netlify app:
4:38:51 PM:   yarn assemble
4:38:51 PM: ​
4:38:51 PM:   Resolved config
4:38:51 PM:   build:
4:38:51 PM:     command: yarn assemble
4:38:51 PM:     commandOrigin: ui
4:38:51 PM:     environment:
4:38:51 PM:       - ALGOLIA_ADMIN_KEY
4:38:51 PM:       - GATSBY_ALGOLIA_APP_ID
4:38:51 PM:       - GATSBY_ALGOLIA_SEARCH_KEY
4:38:51 PM:       - NETLIFY_BUILD_DEBUG
4:38:51 PM:       - YARN_VERSION
4:38:51 PM:       - YARN_FLAGS
4:38:51 PM:     publish: /opt/build/repo/public
4:38:51 PM:     publishOrigin: config
4:38:51 PM:   functionsDirectory: /opt/build/repo/functions
4:38:51 PM:   headers:
4:38:52 PM:     - for: /*      values:        Referrer-Policy: no-referrer-when-downgrade        X-Content-Type-Options: nosniff        X-Frame-Options: SAMEORIGIN        X-XSS-Protection: 1; mode=block  headersOrigin: config  plugins:    - inputs: {}      origin: config      package: netlify-plugin-gatsby-cache  redirects:    - force: true      from: /welcome      status: 301      to: /  redirectsOrigin: configCaching artifacts
4:38:52 PM: Started saving node modules
4:38:52 PM: Finished saving node modules
4:38:52 PM: Started saving build plugins
4:38:52 PM: Finished saving build plugins
4:38:52 PM: Started saving yarn cache
4:39:36 PM: Finished saving yarn cache
4:39:36 PM: Started saving pip cache
4:39:36 PM: Finished saving pip cache
4:39:36 PM: Started saving emacs cask dependencies
4:39:36 PM: Finished saving emacs cask dependencies
4:39:36 PM: Started saving maven dependencies
4:39:36 PM: Finished saving maven dependencies
4:39:36 PM: Started saving boot dependencies
4:39:36 PM: Finished saving boot dependencies
4:39:36 PM: Started saving rust rustup cache
4:39:36 PM: Finished saving rust rustup cache
4:39:36 PM: Started saving go dependencies
4:39:36 PM: Finished saving go dependencies
4:39:42 PM: Cached ruby version 2.7.1
4:39:42 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
4:39:42 PM: Creating deploy upload records
4:39:42 PM: Failing build: Failed to build site
4:39:42 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
4:39:42 PM: Finished processing build request in 13m18.475540238s

The build works fine locally and consumes up to 744 MB of memory in a peak, as measured using the process-top package.

Hi, @Cognifide. I’m guessing that your build command is creating child processes and that the process-top package is only monitoring the parent process. This is then vastly under reporting the actual memory use of the build.

I say this because the site build at Netlify is definitely exceeding the memory limit:

The are two solutions for this and one workaround. The two solutions are:

  • Stay under the memory limit during the build.
  • Upgrade to an Enterprise plan and add the High-Performance Builds add-on to get more build memory.

The workaround would be to build locally (or somewhere else outside of Netlify where more memory is available) and then use manual deploys to upload the build to Netlify.

If there are other questions about this, please let us know.