Netlify Build Error using gatsby and sanity.io

Hello

We are trying to deploy website built with Gatsby & Sanity.io using netlify. We are getting build error in netlify, as shown below.

error Type with name “File” does not exists
9:55:56 PM:
9:55:56 PM:
9:55:56 PM: Error: Type with name “File” does not exists
9:55:56 PM:
9:55:56 PM: - TypeStorage.js:44 SchemaComposer.get
9:55:56 PM: [web]/[graphql-compose]/lib/TypeStorage.js:44:13
9:55:56 PM:
9:55:56 PM: - TypeMapper.js:86 TypeMapper.get
9:55:56 PM: [web]/[graphql-compose]/lib/TypeMapper.js:86:44
9:55:56 PM:
9:55:56 PM: - TypeMapper.js:608 TypeMapper.typeFromAST
9:55:56 PM: [web]/[graphql-compose]/lib/TypeMapper.js:608:17
9:55:56 PM:
9:55:56 PM: - TypeMapper.js:105 TypeMapper.getWrapped
9:55:56 PM: [web]/[graphql-compose]/lib/TypeMapper.js:105:17
9:55:56 PM:
9:55:56 PM: - TypeMapper.js:272 TypeMapper.convertOutputFieldConfig
9:55:56 PM: [web]/[graphql-compose]/lib/TypeMapper.js:272:114
9:55:56 PM:
9:55:56 PM: - configAsThunk.js:19 resolveOutputConfigAsThunk
9:55:56 PM: [web]/[graphql-compose]/lib/utils/configAsThunk.js:19:41
9:55:56 PM:
9:55:56 PM: - ObjectTypeComposer.js:300 ObjectTypeComposer.getFieldConfig
9:55:56 PM: [web]/[graphql-compose]/lib/ObjectTypeComposer.js:300:58
9:55:56 PM:
9:55:56 PM: - ObjectTypeComposer.js:304 ObjectTypeComposer.getFieldType
9:55:56 PM: [web]/[graphql-compose]/lib/ObjectTypeComposer.js:304:17
9:55:56 PM:
9:55:56 PM: - SchemaComposer.js:144
9:55:56 PM: [web]/[graphql-compose]/lib/SchemaComposer.js:144:28
9:55:56 PM:
9:55:56 PM: - Array.forEach
9:55:56 PM:
9:55:56 PM: - SchemaComposer.js:143 SchemaComposer.removeEmptyTypes
9:55:56 PM: [web]/[graphql-compose]/lib/SchemaComposer.js:143:24
9:55:56 PM:
9:55:56 PM: - SchemaComposer.js:154
9:55:56 PM: [web]/[graphql-compose]/lib/SchemaComposer.js:154:18
9:55:56 PM:
9:55:56 PM: - Array.forEach
9:55:56 PM:
9:55:56 PM: - SchemaComposer.js:143 SchemaComposer.removeEmptyTypes
9:55:56 PM: [web]/[graphql-compose]/lib/SchemaComposer.js:143:24
9:55:56 PM:
9:55:56 PM: - SchemaComposer.js:154
9:55:56 PM: [web]/[graphql-compose]/lib/SchemaComposer.js:154:18
9:55:56 PM:
9:55:56 PM: - Array.forEach
9:55:56 PM:
9:55:56 PM:
9:55:56 PM: not finished building schema - 0.465s
9:55:56 PM: error Command failed with exit code 1.
9:55:56 PM: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
9:55:56 PM: ​
9:55:56 PM: ┌─────────────────────────────┐
9:55:56 PM: │ “build.command” failed │
9:55:56 PM: └─────────────────────────────┘
9:55:56 PM: ​
9:55:56 PM: Error message
9:55:56 PM: Command failed with exit code 1: yarn build
9:55:56 PM: ​
9:55:56 PM: Error location
9:55:56 PM: In build.command from netlify.toml:
9:55:56 PM: yarn build
9:55:56 PM: ​
9:55:56 PM: Resolved config
9:55:56 PM: build:
9:55:56 PM: base: /opt/build/repo/web
9:55:56 PM: command: yarn build
9:55:56 PM: commandOrigin: config
9:55:56 PM: publish: /opt/build/repo/web/public

Would appreciate any help. Thank you.

1 Like

hi there, looks like the build log is cut off so its a little hard to say.

This Support Guide contains a ton of useful debugging tips that can likely help you solve your problem :slight_smile:

We also recommend trying to search the forums with the build error you encountered - it’s likely your question was already asked by someone else!

If you are still having problems, please provide as much information as you can on what you have already tried, what your build settings are, your package.json, etc. Thanks!

1 Like

I am new to this. Thanks for your quick support.

Here is the full log.

9:54:22 PM: Build ready to start
9:54:24 PM: build-image version: b0258b965567defc4a2d7e2f2dec2e00c8f73ad6
9:54:24 PM: build-image tag: v3.4.1
9:54:24 PM: buildbot version: db1c11c310036491f94882c0e310ea68c81c7e60
9:54:24 PM: Fetching cached dependencies
9:54:24 PM: Starting to download cache of 11.2MB
9:54:24 PM: Finished downloading cache in 474.832816ms
9:54:24 PM: Starting to extract cache
9:54:25 PM: Finished extracting cache in 146.016023ms
9:54:25 PM: Finished fetching cache in 623.707044ms
9:54:25 PM: Starting to prepare the repo for build
9:54:25 PM: Preparing Git Reference refs/heads/main
9:54:27 PM: Different build dir detected, going to use the one specified in the Netlify configuration file: ‘web’ versus ‘./web’ in the Netlify UI
9:54:27 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: ‘web/public’ versus ‘’ in the Netlify UI
9:54:27 PM: Starting build script
9:54:27 PM: Installing dependencies
9:54:27 PM: Python version set to 2.7
9:54:28 PM: Attempting node version ‘12.16.2’ from .node-version
9:54:28 PM: Downloading and installing node v12.16.2…
9:54:28 PM: Downloading https://nodejs.org/dist/v12.16.2/node-v12.16.2-linux-x64.tar.xz
9:54:29 PM: Computing checksum with sha256sum
9:54:29 PM: Checksums matched!
9:54:31 PM: Now using node v12.16.2 (npm v6.14.4)
9:54:31 PM: Started restoring cached build plugins
9:54:31 PM: Finished restoring cached build plugins
9:54:32 PM: Attempting ruby version 2.7.1, read from environment
9:54:33 PM: Using ruby version 2.7.1
9:54:33 PM: Using PHP version 5.6
9:54:33 PM: 5.2 is already installed.
9:54:33 PM: Using Swift version 5.2
9:54:33 PM: Started restoring cached node modules
9:54:33 PM: Finished restoring cached node modules
9:54:33 PM: Started restoring cached yarn cache
9:54:33 PM: Finished restoring cached yarn cache
9:54:33 PM: Installing yarn at version 1.22.4
9:54:33 PM: Installing Yarn!
9:54:33 PM: > Downloading tarball…
9:54:33 PM: [1/2]: https://yarnpkg.com/downloads/1.22.4/yarn-v1.22.4.tar.gz --> /tmp/yarn.tar.gz.dlU6cKocjI
9:54:33 PM: % Total % Received % Xferd Average Speed Time Time Time Current
9:54:33 PM: Dload Upload Total Spent Left Speed
9:54:33 PM: 0 0 0 0 0 0 0 0 --:–:-- --:–:-- --:–:-- 0
9:54:33 PM: 100 80 100 80 0 0 298 0 --:–:-- --:–:-- --:–:-- 299
9:54:34 PM: 100 93 100 93 0 0 141 0 --:–:-- --:–:-- --:–:-- 141
9:54:34 PM: 0 0 0 0 0 0 0 0 --:–:-- --:–:-- --:–:-- 0
9:54:34 PM: 100 643 100 643 0 0 695 0 --:–:-- --:–:-- --:–:-- 627k
9:54:35 PM: 100 1215k 100 1215k 0 0 899k 0 0:00:01 0:00:01 --:–:-- 899k
9:54:35 PM: [2/2]: https://yarnpkg.com/downloads/1.22.4/yarn-v1.22.4.tar.gz.asc --> /tmp/yarn.tar.gz.dlU6cKocjI.asc
9:54:35 PM: 100 84 100 84 0 0 2951 0 --:–:-- --:–:-- --:–:-- 2951
9:54:35 PM: 100 97 100 97 0 0 1720 0 --:–:-- --:–:-- --:–:-- 1720
9:54:35 PM: 100 647 100 647 0 0 3469 0 --:–:-- --:–:-- --:–:-- 3469
9:54:35 PM: 100 1028 100 1028 0 0 3419 0 --:–:-- --:–:-- --:–:-- 3419
9:54:35 PM: > Verifying integrity…
9:54:35 PM: gpg: Signature made Mon 09 Mar 2020 03:52:13 PM UTC using RSA key ID 69475BAA
9:54:35 PM: gpg: Good signature from “Yarn Packaging yarn@dan.cx
9:54:35 PM: gpg: WARNING: This key is not certified with a trusted signature!
9:54:35 PM: gpg: There is no indication that the signature belongs to the owner.
9:54:35 PM: Primary key fingerprint: 72EC F46A 56B4 AD39 C907 BBB7 1646 B01B 86E5 0310
9:54:35 PM: Subkey fingerprint: 6D98 490C 6F1A CDDD 448E 4595 4F77 6793 6947 5BAA
9:54:35 PM: > GPG signature looks good
9:54:35 PM: > Extracting to ~/.yarn…
9:54:35 PM: > Adding to PATH... 9:54:35 PM: > Successfully installed Yarn 1.22.4! Please open another terminal where the `yarn` command will now be available. 9:54:36 PM: Installing NPM modules using Yarn version 1.22.4 9:54:36 PM: yarn install v1.22.4 9:54:36 PM: warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json. 9:54:36 PM: [1/4] Resolving packages... 9:54:37 PM: [2/4] Fetching packages... 9:54:42 PM: warning url-loader@1.1.2: Invalid bin field for "url-loader". 9:55:08 PM: info fsevents@2.1.2: The platform "linux" is incompatible with this module. 9:55:08 PM: info "fsevents@2.1.2" is an optional dependency and failed compatibility check. Excluding it from installation. 9:55:08 PM: info fsevents@1.2.9: The platform "linux" is incompatible with this module. 9:55:08 PM: info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation. 9:55:08 PM: info fsevents@2.1.3: The platform "linux" is incompatible with this module. 9:55:08 PM: info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation. 9:55:08 PM: [3/4] Linking dependencies... 9:55:08 PM: warning " > gatsby-plugin-load-script@1.1.0" has incorrect peer dependency "gatsby@^2.20.12". 9:55:08 PM: warning "gatsby-plugin-sass > sass-loader@7.3.1" has unmet peer dependency "webpack@^3.0.0 || ^4.0.0". 9:55:08 PM: warning "gatsby-plugin-typescript > babel-plugin-remove-graphql-queries@2.9.1" has unmet peer dependency "graphql@^14.1.1". 9:55:08 PM: warning " > react-three-fiber@4.2.17" has incorrect peer dependency "react@>=16.13". 9:55:08 PM: warning " > react-three-fiber@4.2.17" has incorrect peer dependency "react-dom@>=16.13". 9:55:08 PM: warning "react-three-fiber > react-reconciler@0.25.1" has incorrect peer dependency "react@^16.13.1". 9:55:08 PM: warning "react-three-fiber > react-use-measure@2.0.1" has incorrect peer dependency "react@>=16.13". 9:55:08 PM: warning "react-three-fiber > react-use-measure@2.0.1" has incorrect peer dependency "react-dom@>=16.13". 9:55:08 PM: warning " > react-youtube@7.11.2" has unmet peer dependency "@types/youtube@0.0.38". 9:55:28 PM: [4/4] Building fresh packages... 9:55:47 PM: Done in 71.39s. 9:55:48 PM: NPM modules installed using Yarn 9:55:48 PM: Started restoring cached go cache 9:55:48 PM: Finished restoring cached go cache 9:55:48 PM: go version go1.14.4 linux/amd64 9:55:48 PM: go version go1.14.4 linux/amd64 9:55:48 PM: Installing missing commands 9:55:48 PM: Verify run directory 9:55:49 PM: ​ 9:55:49 PM: ┌─────────────────────────────┐ 9:55:49 PM: │ Netlify Build │ 9:55:49 PM: └─────────────────────────────┘ 9:55:49 PM: ​ 9:55:49 PM: ❯ Version 9:55:49 PM: @netlify/build 5.0.0 9:55:49 PM: ​ 9:55:49 PM: ❯ Flags 9:55:49 PM: deployId: 5f8877b62596f10007057782 9:55:49 PM: mode: buildbot 9:55:49 PM: ​ 9:55:49 PM: ❯ Current directory 9:55:49 PM: /opt/build/repo/web 9:55:49 PM: ​ 9:55:49 PM: ❯ Config file 9:55:49 PM: /opt/build/repo/web/netlify.toml 9:55:49 PM: ​ 9:55:49 PM: ❯ Context 9:55:49 PM: production 9:55:49 PM: ​ 9:55:49 PM: ❯ Loading plugins 9:55:49 PM: - netlify-plugin-gatsby-cache@0.3.0 from netlify.toml 9:55:49 PM: ​ 9:55:49 PM: ┌────────────────────────────────────────────────────────┐ 9:55:49 PM: │ 1. onPreBuild command from netlify-plugin-gatsby-cache │ 9:55:49 PM: └────────────────────────────────────────────────────────┘ 9:55:49 PM: ​ 9:55:50 PM: No Gatsby cache found. Building fresh. 9:55:50 PM: ​ 9:55:50 PM: (netlify-plugin-gatsby-cache onPreBuild completed in 241ms) 9:55:50 PM: ​ 9:55:50 PM: ┌────────────────────────────────────┐ 9:55:50 PM: │ 2. build.command from netlify.toml │ 9:55:50 PM: └────────────────────────────────────┘ 9:55:50 PM: ​ 9:55:50 PM: yarn build
9:55:50 PM: yarn run v1.22.4
9:55:50 PM: $ gatsby build
9:55:52 PM: success open and validate gatsby-configs - 0.021s
9:55:53 PM: success load plugins - 0.722s
9:55:53 PM: success onPreInit - 0.001s
9:55:53 PM: success delete html and css files from previous builds - 0.010s
9:55:53 PM: success initialize cache - 0.006s
9:55:53 PM: success copy gatsby files - 0.032s
9:55:53 PM: info [sanity] Fetching remote GraphQL schema
9:55:55 PM: info [sanity] Transforming to Gatsby-compatible GraphQL SDL
9:55:55 PM: warning [sanity] Type SanityAssetSourceData has field with name id, which conflicts with Gatsby’s internal properties. Renaming to sanityIdinfo [sanity] Stitching GraphQL schemas from SDL
9:55:56 PM: success onPreBootstrap - 2.470s
9:55:56 PM: success createSchemaCustomization - 0.001s
9:55:56 PM: info [sanity] Fetching export stream for dataset
9:55:56 PM: info [sanity] Done exporting!
9:55:56 PM: warning The gatsby-source-sanity plugin has generated no Gatsby nodes. Do you need it?
9:55:56 PM: success source and transform nodes - 0.204s
9:55:56 PM: error Type with name “File” does not exists
9:55:56 PM:
9:55:56 PM:
9:55:56 PM: Error: Type with name “File” does not exists
9:55:56 PM:
9:55:56 PM: - TypeStorage.js:44 SchemaComposer.get
9:55:56 PM: [web]/[graphql-compose]/lib/TypeStorage.js:44:13
9:55:56 PM:
9:55:56 PM: - TypeMapper.js:86 TypeMapper.get
9:55:56 PM: [web]/[graphql-compose]/lib/TypeMapper.js:86:44
9:55:56 PM:
9:55:56 PM: - TypeMapper.js:608 TypeMapper.typeFromAST
9:55:56 PM: [web]/[graphql-compose]/lib/TypeMapper.js:608:17
9:55:56 PM:
9:55:56 PM: - TypeMapper.js:105 TypeMapper.getWrapped
9:55:56 PM: [web]/[graphql-compose]/lib/TypeMapper.js:105:17
9:55:56 PM:
9:55:56 PM: - TypeMapper.js:272 TypeMapper.convertOutputFieldConfig
9:55:56 PM: [web]/[graphql-compose]/lib/TypeMapper.js:272:114
9:55:56 PM:
9:55:56 PM: - configAsThunk.js:19 resolveOutputConfigAsThunk
9:55:56 PM: [web]/[graphql-compose]/lib/utils/configAsThunk.js:19:41
9:55:56 PM:
9:55:56 PM: - ObjectTypeComposer.js:300 ObjectTypeComposer.getFieldConfig
9:55:56 PM: [web]/[graphql-compose]/lib/ObjectTypeComposer.js:300:58
9:55:56 PM:
9:55:56 PM: - ObjectTypeComposer.js:304 ObjectTypeComposer.getFieldType
9:55:56 PM: [web]/[graphql-compose]/lib/ObjectTypeComposer.js:304:17
9:55:56 PM:
9:55:56 PM: - SchemaComposer.js:144
9:55:56 PM: [web]/[graphql-compose]/lib/SchemaComposer.js:144:28
9:55:56 PM:
9:55:56 PM: - Array.forEach
9:55:56 PM:
9:55:56 PM: - SchemaComposer.js:143 SchemaComposer.removeEmptyTypes
9:55:56 PM: [web]/[graphql-compose]/lib/SchemaComposer.js:143:24
9:55:56 PM:
9:55:56 PM: - SchemaComposer.js:154
9:55:56 PM: [web]/[graphql-compose]/lib/SchemaComposer.js:154:18
9:55:56 PM:
9:55:56 PM: - Array.forEach
9:55:56 PM:
9:55:56 PM: - SchemaComposer.js:143 SchemaComposer.removeEmptyTypes
9:55:56 PM: [web]/[graphql-compose]/lib/SchemaComposer.js:143:24
9:55:56 PM:
9:55:56 PM: - SchemaComposer.js:154
9:55:56 PM: [web]/[graphql-compose]/lib/SchemaComposer.js:154:18
9:55:56 PM:
9:55:56 PM: - Array.forEach
9:55:56 PM:
9:55:56 PM:
9:55:56 PM: not finished building schema - 0.465s
9:55:56 PM: error Command failed with exit code 1.
9:55:56 PM: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
9:55:56 PM: ​
9:55:56 PM: ┌─────────────────────────────┐
9:55:56 PM: │ “build.command” failed │
9:55:56 PM: └─────────────────────────────┘
9:55:56 PM: ​
9:55:56 PM: Error message
9:55:56 PM: Command failed with exit code 1: yarn build
9:55:56 PM: ​
9:55:56 PM: Error location
9:55:56 PM: In build.command from netlify.toml:
9:55:56 PM: yarn build
9:55:56 PM: ​
9:55:56 PM: Resolved config
9:55:56 PM: build:
9:55:56 PM: base: /opt/build/repo/web
9:55:56 PM: command: yarn build
9:55:56 PM: commandOrigin: config
9:55:56 PM: publish: /opt/build/repo/web/public
9:55:56 PM: plugins:
9:55:56 PM: - inputs: {}
9:55:56 PM: origin: config
9:55:56 PM: package: netlify-plugin-gatsby-cache
9:55:56 PM: Caching artifacts
9:55:56 PM: Started saving node modules
9:55:56 PM: Finished saving node modules
9:55:56 PM: Started saving build plugins
9:55:56 PM: Finished saving build plugins
9:55:56 PM: Started saving yarn cache
9:55:56 PM: Finished saving yarn cache
9:55:56 PM: Started saving pip cache
9:55:57 PM: Finished saving pip cache
9:55:57 PM: Started saving emacs cask dependencies
9:55:57 PM: Finished saving emacs cask dependencies
9:55:57 PM: Started saving maven dependencies
9:55:57 PM: Finished saving maven dependencies
9:55:57 PM: Started saving boot dependencies
9:55:57 PM: Finished saving boot dependencies
9:55:57 PM: Started saving go dependencies
9:55:57 PM: Finished saving go dependencies
9:56:00 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
9:56:00 PM: Failing build: Failed to build site
9:56:00 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 2
9:56:00 PM: Finished processing build request in 1m36.387484474s

hi there, the problem is definitely coming from here:

9:55:56 PM: error Type with name “File” does not exists
9:55:56 PM:
9:55:56 PM:
9:55:56 PM: Error: Type with name “File” does not exists
9:55:56 PM:
9:55:56 PM: - TypeStorage.js:44 SchemaComposer.get

I’m not 100% sure what is causing this issue - are you able to get this to build locally?

Hello,

Not able to build locally also.

hi there vinodsoft,

if you aren’t able to build locally, then we can rule out a netlify issue - this error is being caused by something else in that case. If you were able to build locally and not deploy, we would know that netlify is part of the problem, but this is not the case.

I would suggest that you reach out to the support channels provided by sanity.io or gatsby to help resolve this issue! If you have problems fixing things when you deploy to netlify, please come on back.