apollo-link-scalars
apollo-link-scalars copied to clipboard
Cannot use GraphQLScalarType "Boolean" from another module or realm
-
I'm submitting a ... [x] bug report [ ] feature request [ ] question about the decisions made in the repository [ ] question about how to use this project
-
Summary Unable to run the app when calling
withScalars
and completely crashes.
I get the following error
ERROR Error: Cannot use GraphQLScalarType "Boolean" from another module or realm.
Ensure that there is only one instance of "graphql" in the node_modules
directory. If different versions of "graphql" are the dependencies of other
relied on modules, use "resolutions" to ensure only one version is installed.
- Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.) I have setup my ApolloClient like so:
import { withScalars } from 'apollo-link-scalars';
import config from '@/config';
import { ApolloClient, ApolloLink, HttpLink } from '@apollo/client';
import { RetryLink } from '@apollo/client/link/retry';
import cache from './cache';
import introspectionResult from "./../graphql.schema.json";
import { buildClientSchema, IntrospectionQuery } from "graphql";
const schema = buildClientSchema((introspectionResult as unknown) as IntrospectionQuery) as any;
const retryLink = new RetryLink();
const httpLink = new HttpLink({ uri: config.API_URL });
const client = new ApolloClient({
cache,
link: ApolloLink.from([
withScalars({ schema }),
retryLink,
httpLink
])
});
export default client;
I have tried to enforce the graphql version with the following in my package.json
"overrides": {
"graphql": "^16.0.0"
},
"resolutions": {
"graphql": "^16.0.0"
},
Anybody else have this issue?
@stretch0 Could you provide a minimal repo with the problem? I cannot reproduce it in my project :/