Gatsby | Getting warning for simple query: "takes too long"

I’m getting a warning on my Gatsby site build:

warning Query takes too long:
File path: /opt/build/repo/src/components/site-navigation/logo.js

The query is for 1 local image that’s 200kb in size:

const data = useStaticQuery(graphql`
query {
file(relativePath: { eq: "logo.png" }) {
  childImageSharp {
    fluid(maxWidth: 200, quality: 64) {
      ...GatsbyImageSharpFluid_withWebp_noBase64
    }
  }
}

}
`)

As the query is for 1 image I’m really not sure why I’d be getting this warning! Sometimes my build fails because it goes over the allowed time so it’d be good to get this sorted.

Any help appreciated.

hi there, could you post the full error log, please? thanks!

11:09:31 AM: Build ready to start
11:09:32 AM: build-image version: e4d2dbe4cfec46db257e869258461ded89b75c9b
11:09:32 AM: build-image tag: v3.7.3
11:09:32 AM: buildbot version: 3570adff9e775d96a22963f85b54bfee165e30b9
11:09:33 AM: Building without cache
11:09:33 AM: Starting to prepare the repo for build
11:09:33 AM: No cached dependencies found. Cloning fresh repo
11:09:33 AM: git clone https://github.com/ruben00001/amyrodriguez_frontend--gatsby--v2
11:09:34 AM: Preparing Git Reference refs/heads/main
11:09:34 AM: Parsing package.json dependencies
11:09:35 AM: Different publish path detected, going to use the one specified in the Netlify configuration file: ‘public’ versus ‘public/’ in the Netlify UI
11:09:36 AM: Starting build script
11:09:36 AM: Installing dependencies
11:09:36 AM: Python version set to 2.7
11:09:37 AM: v12.18.0 is already installed.
11:09:38 AM: Now using node v12.18.0 (npm v6.14.4)
11:09:38 AM: Started restoring cached build plugins
11:09:38 AM: Finished restoring cached build plugins
11:09:38 AM: Attempting ruby version 2.7.1, read from environment
11:09:39 AM: Using ruby version 2.7.1
11:09:39 AM: Using PHP version 5.6
11:09:39 AM: Started restoring cached node modules
11:09:39 AM: Finished restoring cached node modules
11:09:40 AM: Installing NPM modules using NPM version 6.14.4
11:10:30 AM: > sharp@0.27.2 install /opt/build/repo/node_modules/sharp
11:10:30 AM: > (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
11:10:31 AM: info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.10.5/libvips-8.10.5-linux-x64.tar.br
11:10:34 AM: > core-js@2.6.12 postinstall /opt/build/repo/node_modules/babel-polyfill/node_modules/core-js
11:10:34 AM: > node -e “try{require(‘./postinstall’)}catch(e){}”
11:10:34 AM: > core-js@2.6.12 postinstall /opt/build/repo/node_modules/babel-register/node_modules/core-js
11:10:34 AM: > node -e “try{require(‘./postinstall’)}catch(e){}”
11:10:34 AM: > core-js@2.6.11 postinstall /opt/build/repo/node_modules/babel-runtime/node_modules/core-js
11:10:34 AM: > node -e “try{require(‘./postinstall’)}catch(e){}”
11:10:34 AM: > core-js@3.9.1 postinstall /opt/build/repo/node_modules/core-js
11:10:34 AM: > node -e “try{require(‘./postinstall’)}catch(e){}”
11:10:34 AM: > core-js-pure@3.10.1 postinstall /opt/build/repo/node_modules/core-js-pure
11:10:34 AM: > node -e “try{require(‘./postinstall’)}catch(e){}”
11:10:35 AM: > gatsby-telemetry@1.10.1 postinstall /opt/build/repo/node_modules/gatsby-plugin-page-creator/node_modules/gatsby-telemetry
11:10:35 AM: > node src/postinstall.js || true
11:10:35 AM: > gatsby-telemetry@1.10.1 postinstall /opt/build/repo/node_modules/gatsby-recipes/node_modules/gatsby-telemetry
11:10:35 AM: > node src/postinstall.js || true
11:10:35 AM: > gatsby-telemetry@1.10.1 postinstall /opt/build/repo/node_modules/gatsby/node_modules/gatsby-telemetry
11:10:35 AM: > node src/postinstall.js || true
11:10:35 AM: > gatsby-telemetry@2.2.0 postinstall /opt/build/repo/node_modules/gatsby-telemetry
11:10:35 AM: > node src/postinstall.js || true
11:10:36 AM: > mozjpeg@7.0.0 postinstall /opt/build/repo/node_modules/mozjpeg
11:10:36 AM: > node lib/install.js
11:10:36 AM: :heavy_check_mark: mozjpeg pre-build test passed successfully
11:10:36 AM: > pngquant-bin@6.0.0 postinstall /opt/build/repo/node_modules/pngquant-bin
11:10:36 AM: > node lib/install.js
11:10:36 AM: :heavy_check_mark: pngquant pre-build test passed successfully
11:10:36 AM: > gatsby-cli@2.19.2 postinstall /opt/build/repo/node_modules/gatsby/node_modules/gatsby-cli
11:10:36 AM: > node scripts/postinstall.js
11:10:36 AM: > gatsby@2.32.12 postinstall /opt/build/repo/node_modules/gatsby
11:10:36 AM: > node scripts/postinstall.js
11:10:39 AM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/fsevents):
11:10:39 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})
11:10:39 AM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/chokidar/node_modules/fsevents):
11:10:39 AM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {“os”:“darwin”,“arch”:“any”} (current: {“os”:“linux”,“arch”:“x64”})
11:10:39 AM: added 2682 packages from 1218 contributors and audited 2689 packages in 58.969s
11:10:42 AM: 218 packages are looking for funding
11:10:42 AM: run npm fund for details
11:10:42 AM: found 7 vulnerabilities (3 low, 1 moderate, 3 high)
11:10:42 AM: run npm audit fix to fix them, or npm audit for details
11:10:42 AM: NPM modules installed
11:10:42 AM: Started restoring cached go cache
11:10:42 AM: Finished restoring cached go cache
11:10:42 AM: go version go1.14.4 linux/amd64
11:10:42 AM: go version go1.14.4 linux/amd64
11:10:42 AM: Installing missing commands
11:10:42 AM: Verify run directory
11:10:43 AM: ​
11:10:43 AM: ────────────────────────────────────────────────────────────────
11:10:43 AM: Netlify Build
11:10:43 AM: ────────────────────────────────────────────────────────────────
11:10:43 AM: ​
11:10:43 AM: ❯ Version
11:10:43 AM: @netlify/build 11.9.1
11:10:43 AM: ​
11:10:43 AM: ❯ Flags
11:10:43 AM: deployId: 6093c05b01e9a39b6d0774f2
11:10:43 AM: ​
11:10:43 AM: ❯ Current directory
11:10:43 AM: /opt/build/repo
11:10:43 AM: ​
11:10:43 AM: ❯ Config file
11:10:43 AM: No config file was defined: using default values.
11:10:43 AM: ​
11:10:43 AM: ❯ Context
11:10:43 AM: production
11:10:43 AM: ​
11:10:43 AM: ────────────────────────────────────────────────────────────────
11:10:43 AM: 1. Build command from Netlify app
11:10:43 AM: ────────────────────────────────────────────────────────────────
11:10:43 AM: ​
11:10:43 AM: $ gatsby build
11:10:47 AM: success open and validate gatsby-configs - 0.094s
11:10:47 AM: warning Plugin gatsby-plugin-sharp is not compatible with your gatsby version 2.32.12 - It requires gatsby@^3.0.0-next.0
11:10:47 AM: warning Plugin gatsby-source-filesystem is not compatible with your gatsby version 2.32.12 - It requires gatsby@^3.0.0-next.0
11:10:48 AM: success load plugins - 1.188s
11:10:48 AM: success onPreInit - 0.047s
11:10:48 AM: success delete html and css files from previous builds - 0.002s
11:10:48 AM: success initialize cache - 0.005s
11:10:48 AM: success copy gatsby files - 0.041s
11:10:48 AM: success onPreBootstrap - 0.017s
11:10:48 AM: success createSchemaCustomization - 0.007s
11:10:48 AM: info Starting to fetch data from Strapi - https://amyrodriguezcms.herokuapp.com/portfolio-pages?_limit=1000
11:10:48 AM: info Starting to fetch data from Strapi - https://amyrodriguezcms.herokuapp.com/products?_limit=1000
11:10:48 AM: info Starting to fetch data from Strapi - https://amyrodriguezcms.herokuapp.com/images?_limit=1000
11:10:48 AM: info Starting to fetch data from Strapi - https://amyrodriguezcms.herokuapp.com/shop-home-heights?_limit=1000
11:10:48 AM: info Starting to fetch data from Strapi - https://amyrodriguezcms.herokuapp.com/press-elements?_limit=1000
11:10:48 AM: info Starting to fetch data from Strapi - https://amyrodriguezcms.herokuapp.com/press-elements-per-rows?_limit=1000
11:10:50 AM: error (node:1610) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
11:10:57 AM: success Fetched Strapi Data - 9.334s
11:10:57 AM:
11:10:57 AM: gatsby-source-shopify/amy-jewellery-x.myshopify.com starting to fetch data from Shopify
11:10:58 AM:
11:10:58 AM: gatsby-source-shopify/amy-jewellery-x.myshopify.com fetched and processed Blog nodes: 228.713ms
11:10:58 AM:
11:10:58 AM: gatsby-source-shopify/amy-jewellery-x.myshopify.com fetched and processed Shop nodes: 231.896ms
11:10:58 AM:
11:10:58 AM: gatsby-source-shopify/amy-jewellery-x.myshopify.com fetched and processed ShopPolicy nodes: 239.293ms
11:10:58 AM:
11:10:58 AM: gatsby-source-shopify/amy-jewellery-x.myshopify.com fetched and processed Page nodes: 243.332ms
11:10:58 AM:
11:10:58 AM: gatsby-source-shopify/amy-jewellery-x.myshopify.com fetched and processed Article nodes: 446.545ms
11:10:58 AM:
11:10:58 AM: gatsby-source-shopify/amy-jewellery-x.myshopify.com fetched and processed Collection nodes: 650.522ms
11:11:02 AM: success Downloading remote files - 1.810s - 60/60 33.14/s
11:11:02 AM:
11:11:02 AM: gatsby-source-shopify/amy-jewellery-x.myshopify.com fetched and processed Product nodes: 4819.557ms
11:11:02 AM:
11:11:02 AM: gatsby-source-shopify/amy-jewellery-x.myshopify.com finished fetching data from Shopify: 4813.916ms
11:11:02 AM: success Checking for changed pages - 0.000s
11:11:02 AM: success source and transform nodes - 14.253s
11:11:02 AM: warning Multiple node fields resolve to the same GraphQL field StrapiPressElements.image.image - [image, image___NODE]. Gatsby will use image___NODE.
11:11:02 AM: warning Multiple node fields resolve to the same GraphQL field StrapiImages.image - [image, image___NODE]. Gatsby will use image___NODE.
11:11:02 AM: warning Multiple node fields resolve to the same GraphQL field StrapiProducts.images.image.image - [image, image___NODE]. Gatsby will use image___NODE.
11:11:02 AM: warning Multiple node fields resolve to the same GraphQL field StrapiPortfolioPages.imageComponents.image.image - [image, image___NODE]. Gatsby will use image___NODE.
11:11:03 AM: success building schema - 0.630s
11:11:27 AM: info Total nodes: 1039, SitePage nodes: 61 (use --verbose for breakdown)
11:11:27 AM: success createPages - 24.437s
11:11:27 AM: success Checking for changed pages - 0.000s
11:13:27 AM: success createPagesStatefully - 119.517s
11:13:40 AM: success update schema - 4.316s
11:13:40 AM: success onPreExtractQueries - 0.202s
11:13:49 AM: success extract queries from components - 9.696s
11:13:50 AM: success write out redirect data - 0.299s
11:16:17 AM: success Build manifest and related icons - 14.112s
11:16:17 AM: success onPostBootstrap - 147.177s
11:16:17 AM: info bootstrap finished - 333.418s
11:16:33 AM: warning Query takes too long:
11:16:33 AM: File path: /opt/build/repo/src/components/cart.js
11:16:33 AM: warning Query takes too long:
11:16:33 AM: File path: /opt/build/repo/src/components/site-navigation/logo.js
11:17:58 AM: success run static queries - 101.310s - 2/2 0.02/s
11:18:12 AM: success run page queries - 13.977s - 68/68 4.87/s
11:18:12 AM: success write out requires - 0.011s
11:27:12 AM: success Building production JavaScript and CSS bundles - 539.415s
11:27:20 AM: success Rewriting compilation hashes - 6.647s
11:37:18 AM: success Building HTML renderer - 6.139s
11:37:19 AM: success Building static HTML for pages - 0.932s - 68/68 72.97/s
11:37:19 AM: info Generated public/sw.js, which will precache 14 files, totaling 513001 bytes.
11:37:19 AM: The following pages will be precached:
11:37:19 AM: /offline-plugin-app-shell-fallback/index.html
11:37:19 AM: success onPostBuild - 0.108s
11:37:19 AM: info Done building in 1595.453743917 sec
11:37:19 AM: ​
11:37:19 AM: (build.command completed in 26m 36s)
11:37:19 AM: ​
11:37:19 AM: ────────────────────────────────────────────────────────────────
11:37:19 AM: 2. Deploy site
11:37:19 AM: ────────────────────────────────────────────────────────────────
11:37:19 AM: ​
11:37:19 AM: Starting to deploy site from ‘public’
11:37:22 AM: Creating deploy tree asynchronously
11:37:22 AM: Creating deploy upload records
11:37:24 AM: 127 new files to upload
11:37:24 AM: 0 new functions to upload
11:37:28 AM: Site deploy was successfully initiated
11:37:28 AM: ​
11:37:28 AM: (Deploy site completed in 8.3s)
11:37:28 AM: ​
11:37:28 AM: ────────────────────────────────────────────────────────────────
11:37:28 AM: Netlify Build Complete
11:37:28 AM: ────────────────────────────────────────────────────────────────
11:37:28 AM: ​
11:37:28 AM: (Netlify Build completed in 26m 44.4s)
11:37:28 AM: Execution timed out after 27m52.495264553s
11:37:28 AM: Error running command: Command did not finish within the time limit
11:37:28 AM: Creating deploy upload records
11:37:28 AM: Failing build: Failed to build site
11:37:28 AM: Failed during stage ‘building site’: Command did not finish within the time limit
11:37:28 AM: Finished processing build request in 27m55.925872263s
11:37:41 AM: Starting post processing
11:37:41 AM: Post processing - HTML
11:37:42 AM: Minifying js bundle
11:37:44 AM: Minifying js bundle
11:37:46 AM: Minifying js bundle
11:37:48 AM: Minifying js bundle
11:37:50 AM: Minifying js bundle
11:37:53 AM: Minifying js bundle
11:38:01 AM: Minifying js bundle
11:38:03 AM: Minifying js bundle
11:38:04 AM: Post processing - header rules
11:38:04 AM: Post processing - redirect rules
11:38:04 AM: Post processing done
11:38:05 AM: Site is live :sparkles:

Hey there @_Lato_X

Thanks for your patience here, and thanks for sharing that log. You’re right, it is taking a long time for those pages to process. Is it this slow locally as well?

Thanks for getting back to me.

I decided to update Gatsby and migrate to gatsby-plugin-image from gatsby-image and try again from scratch so I’ll leave this issue, at least for now.

hey there, @_Lato_X :wave:

Not a problem! If this pops up again you can follow up on this thread. Thank you :slight_smile:

1 Like