question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

gatsby develop crashing on building schema

See original GitHub issue

Description

gatsby develop crashing on building schema, after removing ‘gatsby-source-prismic’ plugin

`UNHANDLED REJECTION Type with name “File” does not exists

Error: Type with name “File” does not exists

  • TypeStorage.js:44 SchemaComposer.get [*****-prismic-gatsby]/[graphql-compose]/lib/TypeStorage.js:44:13

  • TypeMapper.js:86 TypeMapper.get [*****-prismic-gatsby]/[graphql-compose]/lib/TypeMapper.js:86:44

  • TypeMapper.js:608 TypeMapper.typeFromAST [*****-prismic-gatsby]/[graphql-compose]/lib/TypeMapper.js:608:17

  • TypeMapper.js:105 TypeMapper.getWrapped [*****-prismic-gatsby]/[graphql-compose]/lib/TypeMapper.js:105:17

  • TypeMapper.js:272 TypeMapper.convertOutputFieldConfig [*****-prismic-gatsby]/[graphql-compose]/lib/TypeMapper.js:272:114

  • configAsThunk.js:19 resolveOutputConfigAsThunk [*****-prismic-gatsby]/[graphql-compose]/lib/utils/configAsThunk.js:19:41

  • ObjectTypeComposer.js:300 ObjectTypeComposer.getFieldConfig [*****-prismic-gatsby]/[graphql-compose]/lib/ObjectTypeComposer.js:300:58

  • ObjectTypeComposer.js:304 ObjectTypeComposer.getFieldType [*****-prismic-gatsby]/[graphql-compose]/lib/ObjectTypeComposer.js:304:17

  • SchemaComposer.js:144 tc.getFieldNames.forEach.fieldName [*****-prismic-gatsby]/[graphql-compose]/lib/SchemaComposer.js:144:28

  • Array.forEach

  • SchemaComposer.js:143 SchemaComposer.removeEmptyTypes [*****-prismic-gatsby]/[graphql-compose]/lib/SchemaComposer.js:143:24

  • SchemaComposer.js:154 tc.getFieldNames.forEach.fieldName [*****-prismic-gatsby]/[graphql-compose]/lib/SchemaComposer.js:154:18

  • Array.forEach

  • SchemaComposer.js:143 SchemaComposer.removeEmptyTypes [*****-prismic-gatsby]/[graphql-compose]/lib/SchemaComposer.js:143:24

  • SchemaComposer.js:154 tc.getFieldNames.forEach.fieldName [*****-prismic-gatsby]/[graphql-compose]/lib/SchemaComposer.js:154:18

  • Array.forEach `

Environment

System: OS: macOS 10.14.5 CPU: (4) x64 Intel® Core™ i5-3427U CPU @ 1.80GHz Shell: 2.5.0 - /usr/local/bin/fish Binaries: Node: 10.15.3 - /usr/local/bin/node Yarn: 1.17.3 - /usr/local/bin/yarn npm: 6.10.1 - /usr/local/bin/npm Languages: Python: 2.7.10 - /usr/bin/python Browsers: Chrome: 73.0.3683.86 Firefox: 67.0.4 Safari: 12.1.1 npmPackages: gatsby: 2.13.41 => 2.13.41 gatsby-cli: 2.5.13 => 2.5.13 gatsby-image: 2.0.41 => 2.0.41 gatsby-paginate: 1.0.17 => 1.0.17 gatsby-plugin-eslint: 2.0.5 => 2.0.5 gatsby-plugin-google-tagmanager: 2.0.13 => 2.0.13 gatsby-plugin-offline: ^2.1.1 => 2.2.4 gatsby-plugin-prismic-preview: 2.0.0 => 2.0.0 gatsby-plugin-react-helmet: 3.0.12 => 3.0.12 gatsby-plugin-sharp: 2.0.37 => 2.0.37 gatsby-plugin-styled-components: 3.0.7 => 3.0.7 gatsby-plugin-typography: 2.2.13 => 2.2.13 gatsby-source-graphql-universal: 3.1.6 => 3.1.6 gatsby-source-prismic-graphql: 3.4.0-beta.0 => 3.4.0-beta.0 gatsby-transformer-sharp: 2.1.19 => 2.1.19 npmGlobalPackages: gatsby-cli: 2.7.21

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
stefanprobstcommented, Jul 31, 2019

I’m not sure those two errors actually have the same cause.

@danhowitt i hope the error you’re getting is fixed in gatsby@2.13.45.

@lalmachado something in your project expects a File type to be in the schema but it isn’t. You can try either adding gatsby-source-filesystem to your project, which will add the File type (when there’s at least one file present); or try the createTypes action to manually add a File type (hard to say if/how this would work without more info)

0reactions
kepi0809commented, Oct 29, 2019

important note for gatsby-source-graphql (and in case it is not enough to install the plugin for you):

I also had to put – unlike at other source plugins – in the gatsby-config.js for the plugin (gatsby-source-filesystem) the config snippet

NOTE: The path must be a valid path but it doesn’t have to contain any files, an empty folder works too.

Here’s an example config for the plugin:

    {
      resolve: `gatsby-source-filesystem`,
      options: {
        name: `images`,
        path: `${__dirname}/src/assets/img`,
      },
    },

This could’ve saved me a lot of time, hope it helps somebody! 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting Common Errors - Gatsby
If this is the case, when Gatsby constructs a GraphQL schema it may infer the wrong type because the empty string doesn't look...
Read more >
Gatsby run develop runs into error due to antd and less ...
I think you have conflicting configurations. For example I don't think this is a valid syntax or a valid Gatsby plugin: { resolve:...
Read more >
Build a Modern Blog with Gatsby and MongoDB
If your GatsbyJS website is still running, stop it, run gatsby clean and then gatsby develop to restart the server. The gatsby clean...
Read more >
Gatsby fails to build pages on netlify: WebpackError: Minified ...
My site builds fine locally. On Netlify it crashes when it starts building pages. Here is the netlify log. 9:14:54 AM: Build ready...
Read more >
Issues Updating to Gatsby 4.9.2 : r/gatsbyjs - Reddit
spurious results. as well as - "Missing onError handler for invocation 'building-schema', error was 'Error: Cannot create as TypeComposer the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found