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

Build fails with - Missing onError handler for invocation 'building-schema' #65

Closed
k31tha opened this issue Mar 6, 2021 · 11 comments
Closed
Labels
bug Something isn't working

Comments

@k31tha
Copy link

k31tha commented Mar 6, 2021

When using the option downloadImages: false the build fails with
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".

@sslotsky
Copy link
Contributor

sslotsky commented Mar 9, 2021

Thanks for the issue. Two questions:

  1. Does the same thing happen if you omit the downloadImages option entirely? This flag is treated as false by default so it's not required unless you want to download the images. I suspect you'll still have the issue though.
  2. Is it possible to link your repo so we can reproduce and investigate? Whatever is happening, I suspect that it's specific to your project.

@sslotsky sslotsky added the question Further information is requested label Mar 16, 2021
@davidpaulsson
Copy link
Contributor

davidpaulsson commented Mar 18, 2021

@sslotsky I can confirm this happens for me also. I don't have downloadImages set in my gatsby-config. It only happens when I have gatsby-source-contentful enabled alongside gatsby-source-shopify-experimental. I.e. when only using one or the other plugin it works, but not both at the same time. Also found this person on Twitter when searching for the issue.

Using

"gatsby": "^3.1.0",
"gatsby-source-contentful": "^5.1.0",
"gatsby-source-shopify-experimental": "^1.13.3",

Full error message

 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 (/path/node_modules/graphql/type/schema.js:194:15)
    at SchemaComposer.buildSchema (/path/node_modules/graphql-compose/lib/SchemaComposer.js:179:12)
    at buildSchema (/path/store/node_modules/gatsby/src/schema/schema.js:77:33)
    at build (/path/store/node_modules/gatsby/src/schema/index.js:105:18)
    at buildSchema (/path/store/node_modules/gatsby/src/services/build-schema.ts:19:3)'

After the error is thrown it's just stuck forever at ⠹ building schema.

@sslotsky
Copy link
Contributor

Interesting! Thanks @davidpaulsson for the additional info, I think this will help us figure out the problem.

@sslotsky sslotsky added bug Something isn't working and removed question Further information is requested labels Mar 18, 2021
@rodneylab
Copy link

Hi @sslotsky, I am seeing the same issue as @davidpaulsson. I don't have downloadImages set either. Development build fails if I have both gatsby-source-contentful and gatsby-source-shopify-experimental enabled but succeeds if I drop either from gatsby-config.js. Project is here: https://github.com/rodneylab/rodneylab-100-days-of-gatsby/tree/dev__shopify_bug

Using

    "gatsby": "^3.1.2",
    "gatsby-source-contentful": "^5.1.2"
    "gatsby-source-shopify-experimental": "^1.16.0",

Error message:

 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/XXX/Documents/lab/sites/rodneylab-100-days
-of-gatsby/node_modules/graphql/type/schema.js:194:15)
    at SchemaComposer.buildSchema (/Users/XXX/Documents/lab/sites/rodneylab
-100-days-of-gatsby/node_modules/graphql-compose/lib/SchemaComposer.js:179:12)
    at buildSchema (/Users/XXX/Documents/lab/sites/rodneylab-100-days-of-ga
tsby/node_modules/gatsby/src/schema/schema.js:77:33)
    at build (/Users/XXX/Documents/lab/sites/rodneylab-100-days-of-gatsby/n
ode_modules/gatsby/src/schema/index.js:105:18)
    at buildSchema (/Users/XXX/Documents/lab/sites/rodneylab-100-days-of-ga
tsby/node_modules/gatsby/src/services/build-schema.ts:19:3)'

After the error is thrown it's just stuck forever at ⠹ building schema.

Let me know if you need more details.

@sslotsky
Copy link
Contributor

Thanks @rodneylab! We are working with the gatsby-plugin-image maintainers on this. The problem arises when two different source plugins are using gatsby-plugin-image. Our apologies for the inconvenience!

@davidpaulsson
Copy link
Contributor

No need to apologize to anyone! You're providing code we can make money with. All good in the hood! Thanks for your hard work 🙇

@davidpaulsson
Copy link
Contributor

Any updates regarding this?

@sslotsky
Copy link
Contributor

sslotsky commented Apr 9, 2021

I just checked and I don't think gatsby-plugin-image has a fix for this yet. I'm following up with the team on this and can hopefully get a sense of their priority on it.

@ascorbic
Copy link
Contributor

This is actually a bug in gatsby-source-contentful, rather than this plugin. I've opened a PR which should fix it.

@sslotsky
Copy link
Contributor

Looks like the contentful PR was merged and a release has since been published. Closing this issue.

@rodneylab
Copy link

Thanks for sorting this Sam, works a treat now

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants