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

Schema must contain uniquely named types but contains multiple types named "ID". #3632

Closed
sibelius opened this issue Jun 7, 2022 · 2 comments

Comments

@sibelius
Copy link

sibelius commented Jun 7, 2022

Reporting issues with GraphQL.js

Related problem #2439

When we compile our node server using babel, the node server works well

however, when we bundle the node server using webpack, it throws this error

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

I've tracked down as the collectReferencedTypes (

collectReferencedTypes(type, allReferencedTypes);
) is adding twice the GraphQLScalarType ID

we use graphql-js and graphql-relay, we ensure we only have 1 version of them in our monorepo

we have many schemas in our monorepo (7 schemas)

image

image

We also tried to understand if GraphQLScalarType ID was being called twice, but it was only once

what is the best way to understand and debug this kind of bug?

graphql@16.5.0
graphql-relay@0.7.0

@sibelius
Copy link
Author

sibelius commented Jun 7, 2022

node + babel consume .js files
webpack consumes .mjs files

@sibelius
Copy link
Author

sibelius commented Jun 7, 2022

I had an import like this

import { GraphQLID } from 'graphql/type/scalars';

moving to

import { GraphQLID } from 'graphql';

solved the problem

@sibelius sibelius closed this as completed Jun 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant