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.

Error using new `gatsby-starter-shopify` with `gatsby-source-sanity` plugin.

See original GitHub issue

Description

Hi folks.

I’ve just started rebuilding a Shopify site and I wanted to use the Shopify starter (gatsby-starter-shopify) as a starting point.

The old site is also a Gatsby site, but it is using the old Shopify plugin, and using Sanity as the CMS for everything but product data.

I tried adding the gatsby-source-sanity plugin to start working with the data from the CMS, but unfortunately I’m unable to spin up a dev server.

Steps to reproduce

I’ve put this in an example repo for easy reference here: https://github.com/lukebennett88/gatsby-starter-shopify-with-sanity

I haven’t done anything to gatsby-starter-shopify repo other than:

  • Install gatsby-source-shopify
  • Update .env file
  • Commit lockfile

So it should be pretty easy to get the same error.

Expected result

I’d like to be able to use both the Shopify and the Sanity source plugin together.

Actual result

Here is the output after running npm run start:

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

⠸ building schema

Environment

  System:
    OS: macOS 11.3.1
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
    Shell: 3.2.0 - /usr/local/bin/fish
  Binaries:
    Node: 14.16.1 - /var/folders/db/sb6c_fwd5ld6wrcjyzp7dv2w0000gn/T/fnm_multishells/37342_1621750805315/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 7.13.0 - /var/folders/db/sb6c_fwd5ld6wrcjyzp7dv2w0000gn/T/fnm_multishells/37342_1621750805315/bin/npm
  Languages:
    Python: 2.7.16 - /usr/bin/python
  Browsers:
    Safari: 14.1
  npmPackages:
    gatsby: ^3.4.1 => 3.5.1 
    gatsby-plugin-gatsby-cloud: ^2.4.1 => 2.5.0 
    gatsby-plugin-google-analytics: ^3.4.0 => 3.5.0 
    gatsby-plugin-image: ^1.4.0 => 1.5.0 
    gatsby-plugin-react-helmet: ^4.4.0 => 4.5.0 
    gatsby-plugin-sharp: ^3.4.1 => 3.5.0 
    gatsby-plugin-sitemap: ^4.0.0 => 4.1.0 
    gatsby-source-filesystem: ^3.4.0 => 3.5.0 
    gatsby-source-sanity: ^7.0.4 => 7.0.4 
    gatsby-source-shopify: rc => 5.0.0-rc.23 
    gatsby-transformer-sharp: ^3.4.0 => 3.5.0 

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
jonsherrardcommented, Oct 12, 2021

hi @LekoArts

I’ve got a similar but different issue:

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

is this related at all? I’m trying to upgrade to Gatsby 4, the latest vs of GSS, and also GS-wordpress.

I’ve had a deep google and run through some source code… but I am completely stumped.

1reaction
LekoArtscommented, May 25, 2021

Hey, thanks for the issue!

This is an issue with the Sanity plugin: https://github.com/sanity-io/gatsby-source-sanity/issues/122 Similarly to https://github.com/gatsbyjs/gatsby/pull/30834 they’ll need to fix their plugin.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Hey all! I'm a Sanity newbie and...
I'm trying to add the gatsby-sanity-source plugin and when I try and build the project I get this gnarly error. Failed to validate...
Read more >
Troubleshooting Common Errors - Gatsby
Errors using gatsby -plugin-image and sharp. Field "image" must not have a selection since type "String" has no subfields; Problems installing sharp with ......
Read more >
gatsbyjs - Bountysource
After updating to the latest gatsby-source-contentful@4.3.0 from the canary version we are getting this error. Cannot query field "references" on type ...
Read more >
Missing 'fixed' and 'fluid' fields on image asset with `gatsby ...
I've installed and configured my Gatsby plugins as required: plugins: [ { resolve: `gatsby-source-sanity`, options: { projectId: `mhlt1wid`, ...
Read more >
20.xml - jsDelivr
https://www.jsdelivr.com/package/npm/gatsby-plugin-crisp-chat monthly https://www.jsdelivr.com/package/npm/gatsby-plugin-criteo monthly ...
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