Netlify Plugins with netlify-plugin-gatsby-cache increases build time not reduce

Using netlify plugins with netlify-plugin-gatsby-cache increases build time rather than reducing. I followed your blog post and noticed my builds are now longer. I’m not using any CMS just building from a github repo.

As you can see, my builds are now taking over a minute longer and removing the plugin brings build time back down to normal level.

first enabled build log

11:54:33 AM: Build ready to start
11:54:35 AM: build-image version: 6dfe19d15f524c85d6f9bf7df9fb30b0a9f0a61a
11:54:35 AM: build-image tag: v3.3.10
11:54:35 AM: buildbot version: 6bb3f784302b4ad90de13035b247a363a8bee34a
11:54:35 AM: Fetching cached dependencies
11:54:36 AM: Starting to download cache of 196.9MB
11:54:37 AM: Finished downloading cache in 1.153179315s
11:54:37 AM: Starting to extract cache
11:54:47 AM: Finished extracting cache in 10.139016408s
11:54:47 AM: Finished fetching cache in 11.341071829s
11:54:47 AM: Starting to prepare the repo for build
11:54:47 AM: Preparing Git Reference refs/heads/master
11:54:49 AM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'public' versus 'public/' in the Netlify UI
11:54:49 AM: Starting build script
11:54:49 AM: Installing dependencies
11:54:50 AM: Started restoring cached node version
11:54:57 AM: Finished restoring cached node version
11:55:00 AM: v10.20.1 is already installed.
11:55:01 AM: Now using node v10.20.1 (npm v6.14.4)
11:55:01 AM: Attempting ruby version 2.6.2, read from environment
11:55:02 AM: Using ruby version 2.6.2
11:55:02 AM: Using PHP version 5.6
11:55:02 AM: 5.2 is already installed.
11:55:02 AM: Using Swift version 5.2
11:55:02 AM: Started restoring cached node modules
11:55:02 AM: Finished restoring cached node modules
11:55:02 AM: Started restoring cached yarn cache
11:55:02 AM: Finished restoring cached yarn cache
11:55:03 AM: Installing NPM modules using Yarn version 1.17.0
11:55:04 AM: yarn install v1.17.0
11:55:04 AM: [1/4] Resolving packages...
11:55:05 AM: success Already up-to-date.
11:55:05 AM: Done in 1.16s.
11:55:05 AM: NPM modules installed using Yarn
11:55:06 AM: Started restoring cached go cache
11:55:06 AM: Finished restoring cached go cache
11:55:06 AM: go version go1.12 linux/amd64
11:55:06 AM: go version go1.12 linux/amd64
11:55:06 AM: Installing missing commands
11:55:06 AM: Verify run directory
11:55:08 AM: ​
11:55:08 AM: β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
11:55:08 AM: β”‚        Netlify Build        β”‚
11:55:08 AM: β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
11:55:08 AM: ​
11:55:08 AM: ❯ Version
11:55:08 AM:   @netlify/build 0.4.24
11:55:08 AM: ​
11:55:08 AM: ❯ Flags
11:55:08 AM:   mode: buildbot
11:55:08 AM: ​
11:55:08 AM: ❯ Current directory
11:55:08 AM:   /opt/build/repo
11:55:08 AM: ​
11:55:08 AM: ❯ Config file
11:55:08 AM:   /opt/build/repo/netlify.toml
11:55:08 AM: ​
11:55:08 AM: ❯ Context
11:55:08 AM:   production
11:55:08 AM: ​
11:55:08 AM: ❯ Installing plugins
11:55:08 AM:    - netlify-plugin-gatsby-cache
11:57:06 AM: ​
11:57:06 AM: ❯ Loading plugins
11:57:06 AM:    - netlify-plugin-gatsby-cache@0.2.1
11:57:06 AM: ​
11:57:06 AM: β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
11:57:06 AM: β”‚ 1. onPreBuild command from netlify-plugin-gatsby-cache β”‚
11:57:06 AM: β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
11:57:06 AM: ​
11:57:06 AM: No Gatsby cache found. Building fresh.
11:57:06 AM: ​
11:57:06 AM: (netlify-plugin-gatsby-cache onPreBuild completed in 7ms)
11:57:06 AM: ​
11:57:06 AM: β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
11:57:06 AM: β”‚ 2. build.command from netlify.toml β”‚
11:57:06 AM: β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
11:57:06 AM: ​
11:57:06 AM: $ gatsby build
11:57:12 AM: 
11:57:12 AM: 
11:57:12 AM: success open and validate gatsby-configs - 0.143s
11:57:13 AM: 
11:57:13 AM: success load plugins - 0.960s
11:57:13 AM: success onPreInit - 0.002s
11:57:13 AM: success delete html and css files from previous builds - 0.010s
11:57:13 AM: 
11:57:13 AM: success initialize cache - 0.007s
11:57:13 AM: success copy gatsby files - 0.034s
11:57:13 AM: success onPreBootstrap - 0.012s
11:57:13 AM: 
11:57:13 AM: success createSchemaCustomization - 0.020s
11:57:13 AM: 
11:57:13 AM: success source and transform nodes - 0.516s
11:57:13 AM: 
11:57:13 AM: warning Plugin `gatsby-source-filesystem` tried to define built-in Gatsby GraphQL type `File`
11:57:13 AM: 
11:57:13 AM: 
11:57:13 AM: warning Plugin `gatsby-source-filesystem` tried to define built-in Gatsby GraphQL type `File`
11:57:13 AM: 
11:57:13 AM: warning Plugin `gatsby-source-filesystem` tried to define built-in Gatsby GraphQL type `File`
11:57:14 AM: 
11:57:14 AM: success building schema - 0.623s
11:57:14 AM: 
11:57:14 AM: success createPages - 0.140s
11:57:14 AM: success createPagesStatefully - 0.106s
11:57:14 AM: success onPreExtractQueries - 0.000s
11:57:14 AM: 
11:57:14 AM: success update schema - 0.041s
11:57:15 AM: 
11:57:15 AM: success extract queries from components - 0.528s
11:57:15 AM: success write out requires - 0.004s
11:57:15 AM: 
11:57:15 AM: success write out redirect data - 0.001s
11:57:15 AM: success Build manifest and related icons - 0.197s
11:57:15 AM: 
11:57:15 AM: success onPostBootstrap - 0.198s
11:57:15 AM: 
11:57:15 AM: 
11:57:15 AM: β €
11:57:15 AM: 
11:57:15 AM: info bootstrap finished - 8.662s
11:57:15 AM: 
11:57:15 AM: β €
11:57:23 AM: 
11:57:23 AM: Skipping purge because no template paths provided...
11:57:23 AM: Skipping purge because no template paths provided...
11:57:25 AM: 
11:57:25 AM: warning Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade`
11:57:25 AM: 
11:57:25 AM: warning Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade`
11:57:25 AM: 
11:57:25 AM: warning Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade`
11:57:25 AM: 
11:57:25 AM: 
11:57:25 AM: warning Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade`
11:57:25 AM: 
11:57:25 AM: warning Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade`
11:57:25 AM: 
11:57:25 AM: warning Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade`
11:57:27 AM: Skipping purge because no template paths provided...
11:57:39 AM: 
11:57:39 AM: gatsby-plugin-purgecss: Only processing  /opt/build/repo/src/styles/style.css
11:57:52 AM: 
11:57:52 AM: 
11:57:52 AM: success Building production JavaScript and CSS bundles - 37.331s
11:57:52 AM: 
11:57:52 AM: 
11:57:52 AM: success Rewriting compilation hashes - 0.001s
11:57:53 AM: warning code block or inline code language not specified in markdown. applying generic code block
11:57:53 AM: success run queries - 38.110s - 32/32 0.84/s
11:57:54 AM: success Generating image thumbnails - 1.354s - 5/5 3.69/s
11:57:54 AM: 
11:57:54 AM: 
11:57:54 AM: gatsby-plugin-purgecss:
11:57:54 AM:  Previous CSS Size: 2359.40 KB
11:57:54 AM:  New CSS Size: 32.11 KB (-98.64%)
11:57:54 AM:  Removed ~2327.30 KB of CSS
11:57:54 AM: 
11:57:59 AM: success Building static HTML for pages - 4.711s - 29/29 6.16/s
11:57:59 AM: 
11:57:59 AM: success onPostBuild - 0.023s
11:57:59 AM: info Done building in 52.755 sec
11:57:59 AM: ​
11:57:59 AM: (build.command completed in 53s)
11:57:59 AM: ​
11:57:59 AM: β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
11:57:59 AM: β”‚ 3. onPostBuild command from netlify-plugin-gatsby-cache β”‚
11:57:59 AM: β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
11:57:59 AM: ​
11:57:59 AM: Stored the Gatsby cache to speed up future builds.
11:57:59 AM: ​
11:57:59 AM: (netlify-plugin-gatsby-cache onPostBuild completed in 278ms)
11:57:59 AM: ​
11:57:59 AM: β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
11:57:59 AM: β”‚   Netlify Build Complete    β”‚
11:57:59 AM: β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
11:57:59 AM: ​
11:57:59 AM: (Netlify Build completed in 2m 51.8s)
11:57:59 AM: Caching artifacts
11:57:59 AM: Started saving node modules
11:57:59 AM: Finished saving node modules
11:57:59 AM: Started saving yarn cache
11:57:59 AM: Finished saving yarn cache
11:57:59 AM: Started saving pip cache
11:58:07 AM: Finished saving pip cache
11:58:07 AM: Started saving emacs cask dependencies
11:58:07 AM: Finished saving emacs cask dependencies
11:58:07 AM: Started saving maven dependencies
11:58:07 AM: Finished saving maven dependencies
11:58:07 AM: Started saving boot dependencies
11:58:07 AM: Finished saving boot dependencies
11:58:07 AM: Started saving go dependencies
11:58:07 AM: Finished saving go dependencies
11:58:07 AM: Build script success
11:58:07 AM: Starting to deploy site from 'public'
11:58:07 AM: Creating deploy tree 
11:58:07 AM: Creating deploy upload records
11:58:07 AM: 0 new files to upload
11:58:07 AM: 0 new functions to upload
11:58:08 AM: Starting post processing
11:58:08 AM: Post processing done
11:58:09 AM: Site is live
11:59:01 AM: Finished processing build request in 4m25.850383973s

Second post plugins/cache enabled build

11:59:40 AM: Build ready to start
11:59:42 AM: build-image version: 6dfe19d15f524c85d6f9bf7df9fb30b0a9f0a61a
11:59:42 AM: build-image tag: v3.3.10
11:59:42 AM: buildbot version: 6bb3f784302b4ad90de13035b247a363a8bee34a
11:59:43 AM: Fetching cached dependencies
11:59:43 AM: Starting to download cache of 318.0MB
11:59:44 AM: Finished downloading cache in 1.749705858s
11:59:44 AM: Starting to extract cache
12:00:00 PM: Finished extracting cache in 15.289508962s
12:00:00 PM: Finished fetching cache in 17.160089283s
12:00:00 PM: Starting to prepare the repo for build
12:00:00 PM: Preparing Git Reference refs/heads/master
12:00:05 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'public' versus 'public/' in the Netlify UI
12:00:05 PM: Starting build script
12:00:05 PM: Installing dependencies
12:00:05 PM: Started restoring cached node version
12:00:09 PM: Finished restoring cached node version
12:00:10 PM: v10.20.1 is already installed.
12:00:11 PM: Now using node v10.20.1 (npm v6.14.4)
12:00:12 PM: Attempting ruby version 2.6.2, read from environment
12:00:13 PM: Using ruby version 2.6.2
12:00:13 PM: Using PHP version 5.6
12:00:14 PM: 5.2 is already installed.
12:00:14 PM: Using Swift version 5.2
12:00:14 PM: Started restoring cached node modules
12:00:14 PM: Finished restoring cached node modules
12:00:14 PM: Started restoring cached yarn cache
12:00:14 PM: Finished restoring cached yarn cache
12:00:14 PM: Installing NPM modules using Yarn version 1.17.0
12:00:15 PM: yarn install v1.17.0
12:00:15 PM: [1/4] Resolving packages...
12:00:16 PM: [2/4] Fetching packages...
12:00:44 PM: info fsevents@2.1.3: The platform "linux" is incompatible with this module.
12:00:44 PM: info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
12:00:44 PM: info fsevents@1.2.9: The platform "linux" is incompatible with this module.
12:00:44 PM: info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
12:00:44 PM: info fsevents@2.1.2: The platform "linux" is incompatible with this module.
12:00:44 PM: info "fsevents@2.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
12:00:44 PM: [3/4] Linking dependencies...
12:00:44 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".
12:00:44 PM: warning "gatsby-plugin-netlify > webpack-assets-manifest@3.1.1" has unmet peer dependency "webpack@>=4.4.0".
12:01:01 PM: [4/4] Building fresh packages...
12:01:07 PM: Done in 51.78s.
12:01:07 PM: NPM modules installed using Yarn
12:01:07 PM: Started restoring cached go cache
12:01:07 PM: Finished restoring cached go cache
12:01:07 PM: go version go1.12 linux/amd64
12:01:07 PM: go version go1.12 linux/amd64
12:01:07 PM: Installing missing commands
12:01:07 PM: Verify run directory
12:01:09 PM: ​
12:01:09 PM: β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
12:01:09 PM: β”‚        Netlify Build        β”‚
12:01:09 PM: β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
12:01:09 PM: ​
12:01:09 PM: ❯ Version
12:01:09 PM:   @netlify/build 0.4.24
12:01:09 PM: ​
12:01:09 PM: ❯ Flags
12:01:09 PM:   mode: buildbot
12:01:09 PM: ​
12:01:09 PM: ❯ Current directory
12:01:09 PM:   /opt/build/repo
12:01:09 PM: ​
12:01:09 PM: ❯ Config file
12:01:09 PM:   /opt/build/repo/netlify.toml
12:01:09 PM: ​
12:01:09 PM: ❯ Context
12:01:09 PM:   production
12:01:09 PM: ​
12:01:09 PM: ❯ Installing plugins
12:01:09 PM:    - netlify-plugin-gatsby-cache
12:01:59 PM: ​
12:01:59 PM: ❯ Loading plugins
12:01:59 PM:    - netlify-plugin-gatsby-cache@0.2.1
12:01:59 PM: ​
12:01:59 PM: β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
12:01:59 PM: β”‚ 1. onPreBuild command from netlify-plugin-gatsby-cache β”‚
12:01:59 PM: β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
12:01:59 PM: ​
12:01:59 PM: Found a Gatsby cache. We’re about to go FAST. ⚑️
12:01:59 PM: ​
12:01:59 PM: (netlify-plugin-gatsby-cache onPreBuild completed in 229ms)
12:01:59 PM: ​
12:01:59 PM: β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
12:01:59 PM: β”‚ 2. build.command from netlify.toml β”‚
12:01:59 PM: β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
12:01:59 PM: ​
12:01:59 PM: $ gatsby build
12:02:01 PM: 
12:02:01 PM: success open and validate gatsby-configs - 0.122s
12:02:02 PM: 
12:02:02 PM: success load plugins - 0.903s
12:02:02 PM: 
12:02:02 PM: success onPreInit - 0.002s
12:02:02 PM: success delete html and css files from previous builds - 0.022s
12:02:02 PM: success initialize cache - 0.005s
12:02:02 PM: success copy gatsby files - 0.042s
12:02:02 PM: 
12:02:02 PM: success onPreBootstrap - 0.012s
12:02:02 PM: success createSchemaCustomization - 0.017s
12:02:03 PM: success source and transform nodes - 0.271s
12:02:03 PM: 
12:02:03 PM: warning Plugin `gatsby-source-filesystem` tried to define built-in Gatsby GraphQL type `File`
12:02:03 PM: 
12:02:03 PM: 
12:02:03 PM: warning Plugin `gatsby-source-filesystem` tried to define built-in Gatsby GraphQL type `File`
12:02:03 PM: 
12:02:03 PM: warning Plugin `gatsby-source-filesystem` tried to define built-in Gatsby GraphQL type `File`
12:02:03 PM: success building schema - 0.502s
12:02:03 PM: 
12:02:03 PM: 
12:02:03 PM: success createPages - 0.145s
12:02:03 PM: success createPagesStatefully - 0.111s
12:02:03 PM: success onPreExtractQueries - 0.000s
12:02:03 PM: 
12:02:03 PM: success update schema - 0.042s
12:02:04 PM: 
12:02:04 PM: success extract queries from components - 0.479s
12:02:04 PM: 
12:02:04 PM: success write out requires - 0.004s
12:02:04 PM: 
12:02:04 PM: success write out redirect data - 0.001s
12:02:04 PM: 
12:02:04 PM: success Build manifest and related icons - 0.195s
12:02:04 PM: 
12:02:04 PM: success onPostBootstrap - 0.197s
12:02:04 PM: 
12:02:04 PM: β €
12:02:04 PM: 
12:02:04 PM: info bootstrap finished - 4.953s
12:02:04 PM: β €
12:02:12 PM: Skipping purge because no template paths provided...
12:02:12 PM: Skipping purge because no template paths provided...
12:02:13 PM: warning Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade`
12:02:13 PM: warning Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade`
12:02:13 PM: 
12:02:13 PM: warning Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade`
12:02:13 PM: 
12:02:13 PM: warning Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade`
12:02:13 PM: 
12:02:13 PM: warning Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade`
12:02:13 PM: 
12:02:13 PM: warning Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade`
12:02:15 PM: Skipping purge because no template paths provided...
12:02:27 PM: 
12:02:27 PM: 
12:02:27 PM: gatsby-plugin-purgecss: Only processing  /opt/build/repo/src/styles/style.css
12:02:41 PM: 
12:02:41 PM: success Building production JavaScript and CSS bundles - 37.223s
12:02:42 PM: 
12:02:42 PM: success run queries - 38.017s - 24/24 0.63/s
12:02:42 PM: 
12:02:42 PM: 
12:02:42 PM: gatsby-plugin-purgecss:
12:02:42 PM:  Previous CSS Size: 2359.40 KB
12:02:42 PM: 
12:02:42 PM:  New CSS Size: 32.11 KB (-98.64%)
12:02:42 PM: 
12:02:42 PM:  Removed ~2327.30 KB of CSS
12:02:42 PM: 
12:02:42 PM: 
12:02:47 PM: 
12:02:47 PM: success Building static HTML for pages - 5.164s - 29/29 5.62/s
12:02:47 PM: 
12:02:47 PM: 
12:02:47 PM: success onPostBuild - 0.033s
12:02:47 PM: 
12:02:47 PM: info Done building in 48.261 sec
12:02:48 PM: ​
12:02:48 PM: (build.command completed in 48.5s)
12:02:48 PM: ​
12:02:48 PM: β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
12:02:48 PM: β”‚ 3. onPostBuild command from netlify-plugin-gatsby-cache β”‚
12:02:48 PM: β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
12:02:48 PM: ​
12:02:48 PM: Stored the Gatsby cache to speed up future builds.
12:02:48 PM: ​
12:02:48 PM: (netlify-plugin-gatsby-cache onPostBuild completed in 344ms)
12:02:48 PM: ​
12:02:48 PM: β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
12:02:48 PM: β”‚   Netlify Build Complete    β”‚
12:02:48 PM: β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
12:02:48 PM: ​
12:02:48 PM: (Netlify Build completed in 1m 39.3s)
12:02:48 PM: Caching artifacts
12:02:48 PM: Started saving node modules
12:02:48 PM: Finished saving node modules
12:02:48 PM: Started saving yarn cache
12:02:48 PM: Finished saving yarn cache
12:02:48 PM: Started saving pip cache
12:03:01 PM: Finished saving pip cache
12:03:01 PM: Started saving emacs cask dependencies
12:03:01 PM: Finished saving emacs cask dependencies
12:03:01 PM: Started saving maven dependencies
12:03:01 PM: Finished saving maven dependencies
12:03:01 PM: Started saving boot dependencies
12:03:01 PM: Finished saving boot dependencies
12:03:01 PM: Started saving go dependencies
12:03:01 PM: Finished saving go dependencies
12:03:01 PM: Build script success
12:03:01 PM: Starting to deploy site from 'public'
12:03:01 PM: Creating deploy tree 
12:03:01 PM: Creating deploy upload records
12:03:01 PM: 0 new files to upload
12:03:01 PM: 0 new functions to upload
12:03:01 PM: Starting post processing
12:03:03 PM: Post processing done
12:03:04 PM: Site is live
12:03:57 PM: Finished processing build request in 4m14.168552238s

Notice the plugin appears to install every time which is taking over a minute to do so. Is there a way to get the plugin to be cached?

I noticed that builds were using the command gatsby build rather than npm run build which has the needed environment variable. Made that change, re tested, and still get longer builds

1:03:11 PM: Build ready to start
1:03:13 PM: build-image version: 6dfe19d15f524c85d6f9bf7df9fb30b0a9f0a61a
1:03:13 PM: build-image tag: v3.3.10
1:03:13 PM: buildbot version: 6bb3f784302b4ad90de13035b247a363a8bee34a
1:03:13 PM: Fetching cached dependencies
1:03:13 PM: Starting to download cache of 318.3MB
1:03:14 PM: Finished downloading cache in 1.043886746s
1:03:14 PM: Starting to extract cache
1:03:30 PM: Finished extracting cache in 15.419096827s
1:03:30 PM: Finished fetching cache in 16.535977987s
1:03:30 PM: Starting to prepare the repo for build
1:03:30 PM: Preparing Git Reference refs/heads/master
1:03:33 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'public' versus 'public/' in the Netlify UI
1:03:33 PM: Starting build script
1:03:33 PM: Installing dependencies
1:03:33 PM: Started restoring cached node version
1:03:37 PM: Finished restoring cached node version
1:03:38 PM: v10.20.1 is already installed.
1:03:39 PM: Now using node v10.20.1 (npm v6.14.4)
1:03:39 PM: Attempting ruby version 2.6.2, read from environment
1:03:40 PM: Using ruby version 2.6.2
1:03:41 PM: Using PHP version 5.6
1:03:41 PM: 5.2 is already installed.
1:03:41 PM: Using Swift version 5.2
1:03:41 PM: Started restoring cached node modules
1:03:41 PM: Finished restoring cached node modules
1:03:41 PM: Started restoring cached yarn cache
1:03:41 PM: Finished restoring cached yarn cache
1:03:41 PM: Installing NPM modules using Yarn version 1.17.0
1:03:42 PM: yarn install v1.17.0
1:03:42 PM: [1/4] Resolving packages...
1:03:43 PM: [2/4] Fetching packages...
1:04:09 PM: info fsevents@2.1.3: The platform "linux" is incompatible with this module.
1:04:09 PM: info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
1:04:09 PM: info fsevents@1.2.9: The platform "linux" is incompatible with this module.
1:04:09 PM: info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
1:04:09 PM: info fsevents@2.1.2: The platform "linux" is incompatible with this module.
1:04:09 PM: info "fsevents@2.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
1:04:09 PM: [3/4] Linking dependencies...
1:04:09 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".
1:04:09 PM: warning "gatsby-plugin-netlify > webpack-assets-manifest@3.1.1" has unmet peer dependency "webpack@>=4.4.0".
1:04:26 PM: [4/4] Building fresh packages...
1:04:31 PM: Done in 49.23s.
1:04:31 PM: NPM modules installed using Yarn
1:04:32 PM: Started restoring cached go cache
1:04:32 PM: Finished restoring cached go cache
1:04:32 PM: go version go1.12 linux/amd64
1:04:32 PM: go version go1.12 linux/amd64
1:04:32 PM: Installing missing commands
1:04:32 PM: Verify run directory
1:04:33 PM: ​
1:04:33 PM: β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
1:04:33 PM: β”‚        Netlify Build        β”‚
1:04:33 PM: β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
1:04:33 PM: ​
1:04:33 PM: ❯ Version
1:04:33 PM:   @netlify/build 0.4.24
1:04:33 PM: ​
1:04:33 PM: ❯ Flags
1:04:33 PM:   mode: buildbot
1:04:33 PM: ​
1:04:33 PM: ❯ Current directory
1:04:33 PM:   /opt/build/repo
1:04:33 PM: ​
1:04:33 PM: ❯ Config file
1:04:33 PM:   /opt/build/repo/netlify.toml
1:04:33 PM: ​
1:04:33 PM: ❯ Context
1:04:33 PM:   production
1:04:33 PM: ​
1:04:33 PM: ❯ Installing plugins
1:04:33 PM:    - netlify-plugin-gatsby-cache
1:05:23 PM: ​
1:05:23 PM: ❯ Loading plugins
1:05:23 PM:    - netlify-plugin-gatsby-cache@0.2.1
1:05:23 PM: ​
1:05:23 PM: β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
1:05:23 PM: β”‚ 1. onPreBuild command from netlify-plugin-gatsby-cache β”‚
1:05:23 PM: β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
1:05:23 PM: ​
1:05:24 PM: Found a Gatsby cache. We’re about to go FAST. ⚑️
1:05:24 PM: ​
1:05:24 PM: (netlify-plugin-gatsby-cache onPreBuild completed in 259ms)
1:05:24 PM: ​
1:05:24 PM: β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
1:05:24 PM: β”‚ 2. build.command from netlify.toml β”‚
1:05:24 PM: β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
1:05:24 PM: ​
1:05:24 PM: $ npm run build
1:05:24 PM: > randylough.com@0.1.0 build /opt/build/repo
1:05:24 PM: > GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES=true gatsby build --log-pages
1:05:26 PM: 
1:05:26 PM: 
1:05:26 PM: success open and validate gatsby-configs - 0.129s
1:05:27 PM: 
1:05:27 PM: success load plugins - 0.968s
1:05:27 PM: 
1:05:27 PM: success onPreInit - 0.002s
1:05:27 PM: 
1:05:27 PM: success initialize cache - 0.006s
1:05:27 PM: 
1:05:27 PM: success copy gatsby files - 0.030s
1:05:27 PM: 
1:05:27 PM: success onPreBootstrap - 0.013s
1:05:27 PM: 
1:05:27 PM: success createSchemaCustomization - 0.018s
1:05:28 PM: success source and transform nodes - 0.255s
1:05:28 PM: 
1:05:28 PM: warning Plugin `gatsby-source-filesystem` tried to define built-in Gatsby GraphQL type `File`
1:05:28 PM: warning Plugin `gatsby-source-filesystem` tried to define built-in Gatsby GraphQL type `File`
1:05:28 PM: warning Plugin `gatsby-source-filesystem` tried to define built-in Gatsby GraphQL type `File`
1:05:28 PM: 
1:05:28 PM: success building schema - 0.527s
1:05:28 PM: 
1:05:28 PM: success createPages - 0.141s
1:05:28 PM: success createPagesStatefully - 0.129s
1:05:28 PM: success onPreExtractQueries - 0.000s
1:05:28 PM: 
1:05:28 PM: success update schema - 0.043s
1:05:29 PM: success extract queries from components - 0.517s
1:05:29 PM: success write out requires - 0.004s
1:05:29 PM: success write out redirect data - 0.001s
1:05:29 PM: success Build manifest and related icons - 0.205s
1:05:29 PM: 
1:05:29 PM: success onPostBootstrap - 0.207s
1:05:29 PM: β €
1:05:29 PM: 
1:05:29 PM: info bootstrap finished - 5.153s
1:05:29 PM: β €
1:05:37 PM: Skipping purge because no template paths provided...
1:05:37 PM: 
1:05:37 PM: Skipping purge because no template paths provided...
1:05:39 PM: warning Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade`
1:05:39 PM: 
1:05:39 PM: warning Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade`
1:05:39 PM: 
1:05:39 PM: warning Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade`
1:05:39 PM: 
1:05:39 PM: warning Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade`
1:05:39 PM: warning Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade`
1:05:39 PM: 
1:05:39 PM: warning Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade`
1:05:41 PM: Skipping purge because no template paths provided...
1:05:53 PM: 
1:05:53 PM: gatsby-plugin-purgecss: Only processing  /opt/build/repo/src/styles/style.css
1:06:06 PM: success Building production JavaScript and CSS bundles - 37.310s
1:06:07 PM: 
1:06:07 PM: 
1:06:07 PM: success run queries - 37.574s - 4/4 0.11/s
1:06:07 PM: 
1:06:07 PM: 
1:06:07 PM: gatsby-plugin-purgecss:
1:06:07 PM: 
1:06:07 PM: 
1:06:07 PM:  Previous CSS Size: 2359.40 KB
1:06:07 PM: 
1:06:07 PM:  New CSS Size: 32.11 KB (-98.64%)
1:06:07 PM: 
1:06:07 PM:  Removed ~2327.30 KB of CSS
1:06:07 PM: 
1:06:07 PM: 
1:06:11 PM: success Building static HTML for pages - 4.404s - 0/0 0.00/s
1:06:11 PM: 
1:06:11 PM: success Delete previous page data - 0.000s
1:06:11 PM: 
1:06:11 PM: success onPostBuild - 0.029s
1:06:11 PM: info Done building in 47.22 sec
1:06:12 PM: ​
1:06:12 PM: (build.command completed in 47.8s)
1:06:12 PM: ​
1:06:12 PM: β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
1:06:12 PM: β”‚ 3. onPostBuild command from netlify-plugin-gatsby-cache β”‚
1:06:12 PM: β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
1:06:12 PM: ​
1:06:12 PM: Stored the Gatsby cache to speed up future builds.
1:06:12 PM: ​
1:06:12 PM: (netlify-plugin-gatsby-cache onPostBuild completed in 312ms)
1:06:12 PM: ​
1:06:12 PM: β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
1:06:12 PM: β”‚   Netlify Build Complete    β”‚
1:06:12 PM: β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
1:06:12 PM: ​
1:06:12 PM: (Netlify Build completed in 1m 38.6s)
1:06:12 PM: Caching artifacts
1:06:12 PM: Started saving node modules
1:06:12 PM: Finished saving node modules
1:06:12 PM: Started saving yarn cache
1:06:12 PM: Finished saving yarn cache
1:06:12 PM: Started saving pip cache
1:06:22 PM: Finished saving pip cache
1:06:22 PM: Started saving emacs cask dependencies
1:06:22 PM: Finished saving emacs cask dependencies
1:06:22 PM: Started saving maven dependencies
1:06:22 PM: Finished saving maven dependencies
1:06:22 PM: Started saving boot dependencies
1:06:22 PM: Finished saving boot dependencies
1:06:22 PM: Started saving go dependencies
1:06:22 PM: Finished saving go dependencies
1:06:22 PM: Build script success
1:06:22 PM: Starting to deploy site from 'public'
1:06:22 PM: Creating deploy tree 
1:06:23 PM: Creating deploy upload records
1:06:23 PM: 1 new files to upload
1:06:23 PM: 0 new functions to upload
1:06:26 PM: Starting post processing
1:06:28 PM: Post processing done
1:06:28 PM: Site is live
1:07:14 PM: Finished processing build request in 4m0.995610823s

Thanks for this report! Our Build Plugins team is discussing this issue here:

I’ve added your post there :+1:

Thanks for that link.

I added the plugin to my package.json and that appears to fix the issue they are referring to.

I would suggest updating your docs (or at least that blog post) until you have a permanent fix. You’ll probably have a lot more of these threads otherwise

2 Likes

I was having the same issue, thanks for the detailed breakdown @randallmlough. Fix worked for me as well (average time down from 3.30s to <1.4sec so far, much closer to pre-cache build times).

For anyone else a little unsure on how to β€œadd to package.json” just install the package via yarn or npm. For instance with yarn:
yarn add netlify-plugin-gatsby-cache

I saw immediate improvements in build time.

Hey there! I just added information to the other entry. @randallmlough’s breakdown is excellent, so I’m only adding this for additional context.