Skip to content

2.12.3: Error: Cannot use GraphQLSchema "[object GraphQLSchema]" from another module or realm #1296

@joncursi

Description

@joncursi

After upgrading from apollo@2.12.2 --> apollo@2.12.3, I started receiving the following error while trying to download my schema:

> apollo service:download --endpoint=$API_ENDPOINT_PROXY/v2/graphql graphql-schema.json

  ✔ Loading Apollo Project
  ✖ Saving schema to graphql-schema.json
    → spurious results.
Error: Cannot use GraphQLSchema "[object GraphQLSchema]" 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 instanceOf (~/Sites/nextradata/mmdp/src/mmdp-app/node_modules/apollo/node_modules/graphql/jsutils/instanceOf.js:37:13)
    at isSchema (~/Sites/nextradata/mmdp/src/mmdp-app/node_modules/apollo/node_modules/graphql/type/schema.js:34:34)
    at assertSchema (~/Sites/nextradata/mmdp/src/mmdp-app/node_modules/apollo/node_modules/graphql/type/schema.js:38:4)
    at validateSchema (~/Sites/nextradata/mmdp/src/mmdp-app/node_modules/apollo/node_modules/graphql/type/validate.js:53:28)
    at assertValidSchema (~/Sites/nextradata/mmdp/src/mmdp-app/node_modules/apollo/node_modules/graphql/type/validate.js:77:16)
    at assertValidExecutionArguments (~/Sites/nextradata/mmdp/src/mmdp-app/node_modules/apollo/node_modules/graphql/execution/execute.js:146:35)
    at executeImpl (~/Sites/nextradata/mmdp/src/mmdp-app/node_modules/apollo/node_modules/graphql/execution/execute.js:67:3)
    at execute (~/Sites/nextradata/mmdp/src/mmdp-app/node_modules/apollo/node_modules/graphql/execution/execute.js:62:256)
    at Object.introspectionFromSchema (~/Sites/nextradata/mmdp/src/mmdp-app/node_modules/apollo/node_modules/graphql/utilities/introspectionFromSchema.js:38:37)
    at Task.task (~/Sites/nextradata/mmdp/src/mmdp-app/node_modules/apollo/lib/commands/service/download.js:21:82)
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! mmdp-app@0.0.7 update:schema: `apollo service:download --endpoint=$API_ENDPOINT_PROXY/v2/graphql graphql-schema.json`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the mmdp-app@0.0.7 update:schema script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/joncursi/.npm/_logs/2019-05-23T20_52_56_722Z-debug.log
ERROR: "update:schema" exited with 2.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mmdp-app@0.0.7 update: `dotenv -e .env -- npm-run-all update:schema update:types`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the mmdp-app@0.0.7 update script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/joncursi/.npm/_logs/2019-05-23T20_52_56_754Z-debug.log

Downgrading back to 2.12.2 causes the error to go away.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions