Home
Support Forums

GatsbyJS build hangs for more than 15min

I have noticed recently that my builds last longer than 15 minutes and fail due to timeout. Build is done correctly both on server and on localhost. On localhost it lasts around 4 minutes. Sometimes it passes on prod (14.5 minutes e.g) but mostly fails. The longest step is generating thumbnail images:

12:51:14 AM: success write out requires - 0.007s
12:52:51 AM: success Building production JavaScript and CSS bundles - 96.616s
12:52:52 AM: success Rewriting compilation hashes - 0.003s
1:03:39 AM: success Building static HTML for pages - 18.761s - 81/81 4.32/s
1:03:39 AM: success Generating image thumbnails - 788.341s - 1186/1186 1.50/s
1:03:39 AM: Generated public/sw.js, which will precache 20 files, totaling 749281 bytes.
1:03:39 AM: success onPostBuild - 0.178s
1:03:39 AM: info Done building in 804.549142007 sec
1:03:40 AM: Done in 805.33s.

I decreased resolution of those images and build speeds up on localhost but not on netlify. I cleared cache. Made a new site and the problem persist. The site it hvitis.netlify.app

How could I speed up the build on PROD?
Thank you!

This is full log:

1:22:22 AM: Build ready to start

1:22:24 AM: build-image version: 09c2cdcdf242cf2f57c9ee0fcad9d298fad9ad41

1:22:24 AM: build-image tag: v3.5.0

1:22:24 AM: buildbot version: df708c2c221a3345a3fb36b8609ebca30cb2f6c5

1:22:24 AM: Fetching cached dependencies

1:22:24 AM: Starting to download cache of 443.1MB

1:22:26 AM: Finished downloading cache in 1.737780858s

1:22:26 AM: Starting to extract cache

1:22:38 AM: Finished extracting cache in 12.011822014s

1:22:38 AM: Finished fetching cache in 13.893010895s

1:22:38 AM: Starting to prepare the repo for build

1:22:39 AM: Preparing Git Reference refs/heads/master

1:22:41 AM: Different build dir detected, going to use the one specified in the Netlify configuration file: '' versus '/' in the Netlify UI

1:22:41 AM: Starting build script

1:22:41 AM: Installing dependencies

1:22:41 AM: Python version set to 2.7

1:22:41 AM: Started restoring cached node version

1:22:44 AM: Finished restoring cached node version

1:22:44 AM: v12.18.0 is already installed.

1:22:45 AM: Now using node v12.18.0 (npm v6.14.4)

1:22:45 AM: Started restoring cached build plugins

1:22:45 AM: Finished restoring cached build plugins

1:22:45 AM: Attempting ruby version 2.7.1, read from environment

1:22:46 AM: Using ruby version 2.7.1

1:22:46 AM: Using PHP version 5.6

1:22:46 AM: Started restoring cached node modules

1:22:46 AM: Finished restoring cached node modules

1:22:46 AM: Started restoring cached yarn cache

1:22:46 AM: Finished restoring cached yarn cache

1:22:47 AM: Installing NPM modules using Yarn version 1.22.4

1:22:47 AM: yarn install v1.22.4

1:22:48 AM: [1/4] Resolving packages...

1:22:49 AM: [2/4] Fetching packages...

1:23:06 AM: warning url-loader@1.1.2: Invalid bin field for "url-loader".

1:23:25 AM: info fsevents@1.2.13: The platform "linux" is incompatible with this module.

1:23:25 AM: info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.

1:23:25 AM: [3/4] Linking dependencies...

1:23:25 AM: warning "lerna > @lerna/version > @lerna/github-client > @octokit/rest > @octokit/plugin-request-log@1.0.2" has unmet peer dependency "@octokit/core@>=3".

1:23:25 AM: warning " > tslint@5.20.1" has unmet peer dependency "typescript@>=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev || >=3.0.0-dev || >= 3.1.0-dev || >= 3.2.0-dev".

1:23:25 AM: warning "tslint > tsutils@2.29.0" has unmet peer dependency "typescript@>=2.1.0 || >=2.1.0-dev || >=2.2.0-dev || >=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev || >= 3.0.0-dev || >= 3.1.0-dev".

1:23:25 AM: warning " > tslint-react@3.6.0" has unmet peer dependency "typescript@>=2.1.0 || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev".

1:23:25 AM: warning "workspace-aggregator-c8b33068-e672-4c4b-a0b9-60da8ba93a66 > blog > webpack-cli@3.3.12" has unmet peer dependency "webpack@4.x.x".

1:23:25 AM: warning "workspace-aggregator-c8b33068-e672-4c4b-a0b9-60da8ba93a66 > blog > gatsby-plugin-lodash > lodash-webpack-plugin@0.11.5" has unmet peer dependency "webpack@^2.0.0 || ^3.0.0 || ^4.0.0".

1:23:25 AM: warning "workspace-aggregator-c8b33068-e672-4c4b-a0b9-60da8ba93a66 > blog > gatsby-remark-katex > remark-math@1.0.6" has unmet peer dependency "remark-parse@^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0".

1:23:25 AM: warning "workspace-aggregator-c8b33068-e672-4c4b-a0b9-60da8ba93a66 > blog > 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".

1:23:25 AM: warning "workspace-aggregator-c8b33068-e672-4c4b-a0b9-60da8ba93a66 > blog > gatsby > eslint-plugin-graphql > graphql-config > @endemolshinegroup/cosmiconfig-typescript-loader > ts-node@9.0.0" has unmet peer dependency "typescript@>=2.7".

1:23:49 AM: [4/4] Building fresh packages...

1:23:58 AM: success Saved lockfile.

1:23:58 AM: Done in 70.41s.

1:23:58 AM: NPM modules installed using Yarn

1:23:58 AM: Started restoring cached go cache

1:23:58 AM: Finished restoring cached go cache

1:23:58 AM: go version go1.14.4 linux/amd64

1:23:58 AM: go version go1.14.4 linux/amd64

1:23:58 AM: Installing missing commands

1:23:58 AM: Verify run directory

1:23:59 AM: ​

1:23:59 AM: ┌─────────────────────────────┐

1:23:59 AM: │ Netlify Build │

1:23:59 AM: └─────────────────────────────┘

1:23:59 AM: ​

1:23:59 AM: ❯ Version

1:23:59 AM: @netlify/build 5.2.1

1:23:59 AM: ​

1:23:59 AM: ❯ Flags

1:23:59 AM: deployId: 5faf233ec5fe220007c7dcc3

1:23:59 AM: mode: buildbot

1:23:59 AM: ​

1:23:59 AM: ❯ Current directory

1:23:59 AM: /opt/build/repo

1:23:59 AM: ​

1:23:59 AM: ❯ Config file

1:23:59 AM: No config file was defined: using default values.

1:23:59 AM: ​

1:23:59 AM: ❯ Context

1:23:59 AM: production

1:23:59 AM: ​

1:23:59 AM: ┌───────────────────────────────────┐

1:23:59 AM: │ 1. Build command from Netlify app │

1:23:59 AM: └───────────────────────────────────┘

1:23:59 AM: ​

1:23:59 AM: $ yarn run personal-build

1:23:59 AM: yarn run v1.22.4

1:23:59 AM: $ cd packages/personal-blog && gatsby build

1:24:02 AM: success open and validate gatsby-configs - 0.054s

1:24:04 AM: success load plugins - 1.523s

1:24:04 AM: success onPreInit - 0.037s

1:24:04 AM: success delete html and css files from previous builds - 0.007s

1:24:04 AM: success initialize cache - 0.008s

1:24:04 AM: success copy gatsby files - 0.033s

1:24:04 AM: success onPreBootstrap - 0.492s

1:24:05 AM: success createSchemaCustomization - 0.141s

1:24:05 AM: success Checking for changed pages - 0.000s

1:24:05 AM: success source and transform nodes - 0.523s

1:24:05 AM: success building schema - 0.357s

1:24:06 AM: info Total nodes: 362, SitePage nodes: 72 (use --verbose for breakdown)

1:24:06 AM: success createPages - 0.129s

1:24:06 AM: success Checking for changed pages - 0.000s

1:24:06 AM: success createPagesStatefully - 0.115s

1:24:06 AM: warning There are conflicting field types in your data.

1:24:06 AM: If you have explicitly defined a type for those fields, you can safely ignore this warning message.

1:24:06 AM: Otherwise, Gatsby will omit those fields from the GraphQL schema.

1:24:06 AM: If you know all field types in advance, the best strategy is to explicitly define them with the `createTypes` action, and skip inference with the `@dontInfer` directive.

1:24:06 AM: SitePage.context.tag:

1:24:06 AM: - type: array

1:24:06 AM: value: [ ..., 'LEGO', ... ]

1:24:06 AM: - type: string

1:24:06 AM: value: 'LEGO'

1:24:06 AM: success update schema - 0.040s

1:24:06 AM: success onPreExtractQueries - 0.000s

1:24:12 AM: success extract queries from components - 6.429s

1:24:12 AM: success write out redirect data - 0.005s

1:24:12 AM: success Build manifest and related icons - 0.185s

1:24:12 AM: success onPostBootstrap - 0.187s

1:24:12 AM: info bootstrap finished - 12.833s

1:24:13 AM: warning code block or inline code language not specified in markdown. applying generic code block

1:24:27 AM: warning Query takes too long:

1:24:27 AM: File path: /opt/build/repo/packages/personal-blog/src/containers/HomePage/FeaturedPost/index.tsx

1:24:27 AM: warning Query takes too long:

1:24:27 AM: File path: /opt/build/repo/packages/personal-blog/src/containers/HomePage/Intro/index.tsx

1:24:31 AM: warning Query takes too long:

1:24:31 AM: File path: /opt/build/repo/packages/personal-blog/src/containers/HomePage/Posts/index.tsx

1:24:43 AM: success run static queries - 30.397s - 9/9 0.30/s

1:24:56 AM: success run page queries - 13.141s - 81/81 6.16/s

1:24:56 AM: success write out requires - 0.006s

1:26:33 AM: success Building production JavaScript and CSS bundles - 97.363s

1:26:34 AM: success Rewriting compilation hashes - 0.002s

1:37:40 AM: success Building static HTML for pages - 19.766s - 81/81 4.10/s

1:37:40 AM: success Generating image thumbnails - 807.589s - 1186/1186 1.47/s

1:37:40 AM: Generated public/sw.js, which will precache 20 files, totaling 749281 bytes.

1:37:40 AM: success onPostBuild - 0.174s

1:37:40 AM: info Done building in 820.666123289 sec

1:37:41 AM: Done in 821.29s.

1:37:41 AM: ​

1:37:41 AM: (build.command completed in 13m 41.5s)

1:37:41 AM: ​

1:37:41 AM: ┌─────────────────────────────┐

1:37:41 AM: │ Netlify Build Complete │

1:37:41 AM: └─────────────────────────────┘

1:37:41 AM: ​

1:37:41 AM: (Netlify Build completed in 13m 41.5s)

1:37:41 AM: Execution timed out after 15m0.172148362s

1:37:41 AM: Error running command: Command did not finish within the time limit

1:37:41 AM: Failing build: Failed to build site

1:37:41 AM: Failed during stage 'building site': Command did not finish within the time limit

1:37:41 AM: Finished processing build request in 15m16.80103577s

hey there, so our max limit for builds is indeed 15 minutes - it may be that you are just a little bit over that.

if you add a credit card to the account, we can extend your build time to 30 mins so you can get a successful build - and then you can try and see if you can squeeze it down a bit?