amplify-js: GraphQL error - Cannot use e "__Schema" from another module or realm.
Do you want to request a feature or report a bug? Maybe a bug
What is the current behavior? Using a ionic 3 app and amplify 1.0.5 on android and ios. I get the following graphql error:
Error: Cannot use e “__Schema” 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.
https://yarnpkg.com/en/docs/selective-version-resolutions
Duplicate “graphql” modules cannot be used at the same time since different versions may have different capabilities and behavior. The data from one version used in the function from another could produce confusing and spurious results. at t.a (vendor.js:1) at h (vendor.js:1) at l (vendor.js:1) at F (vendor.js:1) at q (vendor.js:1) at new u (vendor.js:1) at u (vendor.js:1) at Object.<anonymous> (vendor.js:1) at t (vendor.js:1) at Object.<anonymous> (vendor.js:1)
I checked and do not see any other graphql version installed. A debug build works as expected, while a release build with ionic cli 3.2 does not work and results in a white screen with the error above.
npm ls graphql
\ionic\myapp
-- aws-amplify@1.0.5 – @aws-amplify/api@1.0.5
`-- graphql@0.13.0
Anyone else see this?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 26 (3 by maintainers)
For anyone experiencing this problem and finding that setting NODE_ENV when running ionic build like
NODE_ENV=production ionic build --proddoesn’t work, you can fix this by using webpack to inject process.env.NODE_ENV into the build package. I wrote up how I did this here - https://gist.github.com/jmannau/8039787e29190f751aa971b4a91a8901the problem is caused by https://github.com/graphql/graphql-js/issues/1182 - currently suggested solution is to use
NODE_ENV=productionwhich does not make sense for mobile app as this is a static bundle served from a device filesystem. I recommend to put a comment ingraphql-jsticket or open a new one.As I experience same issue with my own Ionic project, for now I downgraded
graphqlto v 0.11.7 and the issue is gone.