datocms / gatsby-source-datocms

Official GatsbyJS source plugin to pull content from DatoCMS
MIT License
140 stars 51 forks source link

Error: Type with name "GatsbyImageLayout" does not exists #184

Closed philr35 closed 2 years ago

philr35 commented 2 years ago

I've recently updated our repo to Gatsby 4.x coming from 3.x. I am running gatsby develop on a repo with 2 pages. The build never gets finished because it throws this error, presumably because an issue with Gatsby version 4.

Missing onError handler for invocation 'building-schema', error was 'Error: Type with name "GatsbyImageLayout" does not exists'. Stacktrace was 'Error: Type with name
"GatsbyImageLayout" does not exists
    at SchemaComposer.get (C:\Users\phill\Desktop\getparlor\frontend-dato-gatsby\node_modules\graphql-compose\lib\TypeStorage.js:44:13)
    at ThunkComposer._thunk (C:\Users\phill\Desktop\getparlor\frontend-dato-gatsby\node_modules\graphql-compose\lib\TypeMapper.js:585:34)
    at ThunkComposer.get ofType [as ofType] (C:\Users\phill\Desktop\getparlor\frontend-dato-gatsby\node_modules\graphql-compose\lib\ThunkComposer.js:20:34)
    at getTypeNode (C:\Users\phill\Desktop\getparlor\frontend-dato-gatsby\node_modules\graphql-compose\lib\utils\definitionNode.js:265:28)
    at getTypeNode (C:\Users\phill\Desktop\getparlor\frontend-dato-gatsby\node_modules\graphql-compose\lib\utils\definitionNode.js:265:12)
    at C:\Users\phill\Desktop\getparlor\frontend-dato-gatsby\node_modules\graphql-compose\lib\utils\definitionNode.js:296:18
    at Array.map (<anonymous>)
    at getArgumentsDefinitionNodes (C:\Users\phill\Desktop\getparlor\frontend-dato-gatsby\node_modules\graphql-compose\lib\utils\definitionNode.js:294:19)
    at C:\Users\phill\Desktop\getparlor\frontend-dato-gatsby\node_modules\graphql-compose\lib\utils\definitionNode.js:326:18
    at Array.map (<anonymous>)
    at getFieldDefinitionNodes (C:\Users\phill\Desktop\getparlor\frontend-dato-gatsby\node_modules\graphql-compose\lib\utils\definitionNode.js:315:21)
    at getObjectTypeDefinitionNode (C:\Users\phill\Desktop\getparlor\frontend-dato-gatsby\node_modules\graphql-compose\lib\utils\definitionNode.js:40:13)
    at ObjectTypeComposer.getType (C:\Users\phill\Desktop\getparlor\frontend-dato-gatsby\node_modules\graphql-compose\lib\ObjectTypeComposer.js:700:76)
    at getGraphQLType (C:\Users\phill\Desktop\getparlor\frontend-dato-gatsby\node_modules\graphql-compose\lib\utils\typeHelpers.js:164:17)
    at C:\Users\phill\Desktop\getparlor\frontend-dato-gatsby\node_modules\graphql-compose\lib\SchemaComposer.js:167:79
    at Array.forEach (<anonymous>)'

If I remove Dato from my gatsby-config.js file the issue goes away.

Also note, I am not importing any data from Dato yet, this repo is simply trying to get a working build going first.

gatsby info:
System:
    OS: Windows 10 10.0.19042
    CPU: (16) x64 AMD Ryzen 7 3700X 8-Core Processor
  Binaries:
    Node: 16.13.1 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.17 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 8.3.0 - ~\AppData\Roaming\npm\npm.CMD
  Languages:
    Python: 3.10.1 - /c/Python310/python
  Browsers:
    Chrome: 96.0.4664.110
    Edge: Spartan (44.19041.1266.0), Chromium (96.0.1054.62)
  npmPackages:
    gatsby: 4.4.0 => 4.4.0
    gatsby-env-variables: ^2.0.0 => 2.0.0
    gatsby-plugin-accessibilityjs: ^1.0.3 => 1.0.3
    gatsby-plugin-alias-imports: ^1.0.5 => 1.0.5
    gatsby-plugin-gatsby-cloud: 4.4.0 => 4.4.0
    gatsby-plugin-google-gtag: 4.4.0 => 4.4.0
    gatsby-plugin-google-tagmanager: 4.4.0 => 4.4.0
    gatsby-plugin-image: ^2.4.0 => 2.4.0
    gatsby-plugin-manifest: 4.4.0 => 4.4.0
    gatsby-plugin-material-ui: 4.1.0 => 4.1.0
    gatsby-plugin-meta-redirect: ^1.1.1 => 1.1.1
    gatsby-plugin-postcss: 5.4.0 => 5.4.0
    gatsby-plugin-react-helmet: 5.4.0 => 5.4.0
    gatsby-plugin-remove-serviceworker: ^1.0.0 => 1.0.0
    gatsby-plugin-robots-txt: ^1.6.10 => 1.6.14
    gatsby-plugin-segment-js: ^3.6.0 => 3.7.0
    gatsby-plugin-sitemap: 5.4.0 => 5.4.0
    gatsby-plugin-styled-components: 5.4.0 => 5.4.0
    gatsby-plugin-typescript: 4.4.0 => 4.4.0
    gatsby-source-datocms: ^3.0.12 => 3.0.12
    gatsby-source-filesystem: 4.4.0 => 4.4.0
    gatsby-source-strapi: 1.0.2 => 1.0.2
  npmGlobalPackages:
    gatsby-cli: 3.0.0
    gatsby: 3.10.2
philr35 commented 2 years ago

Interesting! My presumption was wrong. It does not appear to be a Gatsby v4 issue.

It appears to be an issue with "gatsby-plugin-image": "^2.4.0",.

I removed this from my package.json and the error went away! Why could this be?

I am going to check if downgrading this to an older version will help.

philr35 commented 2 years ago

Figured it out.

Some how "gatsby-plugin-image" went missing from my config file. Closing this.