Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
lukebennett88 opened this issue May 23, 2021 · 5 comments
Closed
Labels
type: bug An issue or pull request relating to a bug in Gatsby type: upstream Issues outside of Gatsby's control, caused by dependencies

Comments

@lukebennett88
Copy link
Contributor

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 
@lukebennett88 lukebennett88 added the type: bug An issue or pull request relating to a bug in Gatsby label May 23, 2021
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label May 23, 2021
@LekoArts LekoArts added type: upstream Issues outside of Gatsby's control, caused by dependencies and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels May 25, 2021
@LekoArts
Copy link
Contributor

Hey, thanks for the issue!

This is an issue with the Sanity plugin: sanity-io/gatsby-source-sanity#122
Similarly to #30834 they'll need to fix their plugin.

@jonsherrard
Copy link

jonsherrard commented 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.

@sahandnayebaziz
Copy link

@jonsherrard I'm getting the same build issue. I'm not using sanity, just the latest gatsby-source-shopify and gatsby-source-wordpress. Can't gatsby develop, getting the same error

@vitustockholm
Copy link

i am using gatsby-source-shopify with err 401, ERROR #gatsby-source-shopify_111002 .

@jonsherrard
Copy link

@sahandnayebaziz I managed to upgrade everything to latest version, but left Gatsby at v3 in the end.

I removed all gatsby-* packages from package.json (includeing gatsby), but saved the list in a text editor.

Then I saved package.json and removed node_modules

Then I reinstalled each package @latest, and everything worked again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug An issue or pull request relating to a bug in Gatsby type: upstream Issues outside of Gatsby's control, caused by dependencies
Projects
None yet
Development

No branches or pull requests

5 participants