Skip to content
This repository has been archived by the owner on Jun 24, 2021. It is now read-only.

Missing onError handler for invocation 'building-schema', error was 'Error: Schema must contain uniquely named types but contains multiple types named "GatsbyImageLayout". #137

Closed
alainkaiser opened this issue May 6, 2021 · 5 comments

Comments

@alainkaiser
Copy link

Hi all.

First of all, thanks for the cool and useful plugin.
I am currently working on a site that will access Shopify data as well as Sanity data (CMS).
The following plugins are used to access the two data stores:

gatsby-config.js:

{
  resolve: 'gatsby-source-sanity',
  options: {
    projectId: process.env.GATSBY_SANITY_PROJECT_ID,
    dataset: process.env.GATSBY_SANITY_DATASET,
    watchMode: true,
  },
},
{
  resolve: 'gatsby-source-shopify',
  options: {
    apiKey: process.env.SHOPIFY_ADMIN_API_KEY,
    password: process.env.SHOPIFY_ADMIN_PASSWORD,
    storeUrl: process.env.SHOPIFY_STORE_URL,
  },
},

If I now start the dev server with "gatsby develop", I am getting the following error:

_`Missing onError handler for invocation 'building-schema', error was 'Error: Schema must contain uniquely named types but contains multiple types named "GatsbyImageLayout".'.
Stacktrace was 'Error: Schema must contain uniquely named types but contains multiple types named "GatsbyImageLayout".
at new GraphQLSchema (/Users/alainkaiser/Documents/source/alainkaiser/easymining.ch-frontend/node_modules/graphql/type/schema.js:194:15)
at SchemaComposer.buildSchema (/Users/alainkaiser/Documents/source/alainkaiser/easymining.ch-frontend/node_modules/graphql-compose/lib/SchemaComposer.js:179:12)
at buildSchema (/Users/alainkaiser/Documents/source/alainkaiser/easymining.ch-frontend/node_modules/gatsby/src/schema/schema.js:76:33)
at build (/Users/alainkaiser/Documents/source/alainkaiser/easymining.ch-frontend/node_modules/gatsby/src/schema/index.js:105:18)
at buildSchema (/Users/alainkaiser/Documents/source/alainkaiser/easymining.ch-frontend/node_modules/gatsby/src/services/build-schema.ts:19:3)'

⠦ building schema`_

I am using the following versions:

"gatsby-source-sanity": "^7.0.0"
"gatsby-source-shopify": "rc"

The whole build process is stuck at the "building schema" step.

After some testing, I have noticed that the build works if I use only one of the two plugins, either "gatsby-source-sanity" or "gatsby-source-shopify". However, the plugins do not work together. Has anyone already had experience with a similar error or an idea for a workaround?

Thanks in advance for the help!

@sslotsky
Copy link
Contributor

sslotsky commented May 6, 2021

We saw this with contentful as well, and I think it turned out to be an issue with how they were using gatsby-plugin-image. I'll try to find more specific information but I suspect we'll have to file a bug with sanity.

@alainkaiser
Copy link
Author

hi @sslotsky Thanks for your response. I already referenced the bug at sanity. Thank you!

@unimprobable
Copy link

@sslotsky Did you ever get anywhere with the Contentful issue? I am seeing this error when upgrading from gatsby-source-shopify v4 to v5. Cannot find other issues mentioning it.

@davidpaulsson
Copy link
Contributor

@unimprobable Have you updated the Contentful source plugin as well? I had this issue previously but I think it's been resolved.

@unimprobable
Copy link

@unimprobable Have you updated the Contentful source plugin as well? I had this issue previously but I think it's been resolved.

That worked, thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants