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: Schema must contain uniquely named types but contains multiple types named "GRVSCStylesheet" #30199

Closed
HassanCorrigan opened this issue Mar 11, 2021 · 5 comments · Fixed by #30318
Assignees
Labels
topic: GraphQL Related to Gatsby's GraphQL layer type: bug An issue or pull request relating to a bug in Gatsby

Comments

@HassanCorrigan
Copy link

Description

Just migrated to Gatsby 3 (3.0.4) and getting the following error after every save in development mode. The error appears in the terminal and Gatsby gets stuck on 'building schema' without ever progressing.

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

Steps to reproduce

Run Gatsby in development mode, make a change to a file and save.

Expected result

Pages should be re-compiled with the reflected changes.

Actual result

Error message displayed as above.

Environment

System:
OS: macOS 11.2.3
CPU: (8) x64 Intel(R) Core(TM) i5-8257U CPU @ 1.40GHz
Shell: 5.8 - /bin/zsh
Binaries:
Node: 15.11.0 - /usr/local/bin/node
npm: 7.6.2 - /usr/local/bin/npm
Languages:
Python: 2.7.16 - /usr/bin/python
Browsers:
Chrome: 89.0.4389.82
Safari: 14.0.3
npmPackages:
gatsby: ^3.0.4 => 3.0.4
gatsby-plugin-feed: ^3.0.0 => 3.0.0
gatsby-plugin-image: ^1.0.1 => 1.0.1
gatsby-plugin-manifest: ^3.0.0 => 3.0.0
gatsby-plugin-offline: ^4.0.0 => 4.0.0
gatsby-plugin-react-helmet: ^4.0.0 => 4.0.0
gatsby-plugin-sharp: ^3.0.1 => 3.0.1
gatsby-plugin-sitemap: ^3.0.0 => 3.0.0
gatsby-remark-external-links: ^0.0.4 => 0.0.4
gatsby-remark-images: ^4.0.0 => 4.0.0
gatsby-remark-vscode: ^3.2.0 => 3.2.0
gatsby-source-filesystem: ^3.0.0 => 3.0.0
gatsby-source-graphql: ^3.0.0 => 3.0.0
gatsby-transformer-remark: ^3.0.0 => 3.0.0
gatsby-transformer-sharp: ^3.0.0 => 3.0.0

@HassanCorrigan HassanCorrigan added the type: bug An issue or pull request relating to a bug in Gatsby label Mar 11, 2021
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Mar 11, 2021
@vladar
Copy link
Contributor

vladar commented Mar 12, 2021

Hi @HassanCorrigan

Sorry to hear you're running into an issue. To help us best begin debugging the underlying cause, it is incredibly helpful if you're able to create a minimal reproduction. This is a simplified example of the issue that makes it clear and obvious what the issue is and how we can begin to debug it.

If you're up for it, we'd very much appreciate if you could provide a minimal reproduction and we'll be able to take another look.

Thanks for using Gatsby! 💜

@vladar vladar added status: needs reproduction This issue needs a simplified reproduction of the bug for further troubleshooting. topic: GraphQL Related to Gatsby's GraphQL layer v3migration and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Mar 12, 2021
@kremalicious
Copy link
Contributor

kremalicious commented Mar 14, 2021

I was running into this too and was able to reproduce this in a minimal test case in https://github.com/kremalicious/gatsby-test-case-30199 based on gatsby-starter-blog.

Looks like the combination Gatsby v3 + gatsby-remark-vscode (which the error implies is at fault) + gatsby-source-graphql will lead to this error.

Not sure which package needs fixing to prevent that, for time being also cross-posted on andrewbranch/gatsby-remark-vscode#144

@tanmancan
Copy link

I've also started running into this error after migrating to v3 (current version: 3.0.4). In my case I have the following message:

Error: Schema must contain uniquely named types but contains multiple types named "File"

This error only occurs when running gatsby develop and does not happen during gatsby build. I was able to narrow down the source of my error to this piece of code:

// gatsby-node.js
exports.createResolvers = ({
  actions,
  cache,
  createNodeId,
  createResolvers,
  store,
  reporter,
}) => {
  const { createNode } = actions;
  createResolvers({
    craft_media_Asset: {
      imageFile: {
        type: `File`,
        resolve(source, args, context, info) {
          return createRemoteFileNode({
            url: source.url,
            store,
            cache,
            createNode,
            createNodeId,
            reporter,
          });
        },
      },
    },
  });
};

Removing that code also removes the error.

The snippet above is from the Gatsby docs here: https://www.gatsbyjs.com/docs/reference/graphql-data-layer/schema-customization/#feeding-remote-images-into-gatsby-image

This is the output of my gatsby info

System:
    OS: Linux 4.19 Ubuntu 18.04.2 LTS (Bionic Beaver)
    CPU: (8) x64 Intel(R) Core(TM) i7-9700K CPU @ 3.60GHz
    Shell: 5.4.2 - /usr/bin/zsh
  Binaries:
    Node: 14.16.0 - ~/.nvm/versions/node/v14.16.0/bin/node
    npm: 7.6.3 - ~/.nvm/versions/node/v14.16.0/bin/npm
  npmPackages:
    gatsby: ^3.0.4 => 3.0.4
    gatsby-plugin-image: ^1.0.1 => 1.0.1
    gatsby-plugin-manifest: ^3.0.0 => 3.0.0
    gatsby-plugin-react-helmet: ^4.0.0 => 4.0.0
    gatsby-plugin-sharp: ^3.0.1 => 3.0.1
    gatsby-plugin-styled-components: ^4.0.0 => 4.0.0
    gatsby-plugin-typescript: ^3.0.0 => 3.0.0
    gatsby-source-filesystem: ^3.0.0 => 3.0.0
    gatsby-source-graphql: ^3.0.0 => 3.0.0
    gatsby-transformer-sharp: ^3.0.0 => 3.0.0

@vladar vladar self-assigned this Mar 15, 2021
@vladar vladar removed the status: needs reproduction This issue needs a simplified reproduction of the bug for further troubleshooting. label Mar 15, 2021
@vladar
Copy link
Contributor

vladar commented Mar 15, 2021

Thanks for the reproduction! I am definitely seeing the same error, so will investigate soon.

@rroslaniec
Copy link

rroslaniec commented Mar 15, 2021

I got also errors with code:

exports.createResolvers = ({
  actions,
  cache,
  createNodeId,
  createResolvers,
  store,
  reporter,
}) => {
  const { createNode } = actions;

  const imageFileResolver = {
    imageFile: {
      type: `File`,
      resolve(source) {
        return createRemoteFileNode({
          url: `${process.env.API_URL}${source.url}`,
          store,
          cache,
          createNode,
          createNodeId,
          reporter,
        });
      },
    },
  };
  createResolvers({
    StrapiXXXX: imageFileResolver,
    StrapiYYYY: imageFileResolver,
  });
};

But it fails with files from Strapi admin panel:

Error: Unexpected error value: "failed to process http://localhost:1337/uploads/132063640_846610245908988_778179827344024939_n_23669da13e.jpg\nFailed to download http://localhost:1337/uploads/132063640_846610245908988_778179827344024939
_n_23669da13e.jpg after 3 attempts"

EDIT:
Ofc file is present ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: GraphQL Related to Gatsby's GraphQL layer type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants