# JEST testcases failing after appolo-server-express upgrade from v2 to v3

**URL:** <https://community.apollographql.com/t/jest-testcases-failing-after-appolo-server-express-upgrade-from-v2-to-v3/7939>\
**Category:** Server\
**Tags:** server\
**Created:** [November 11, 2024, 9:49am UTC](https://community.apollographql.com/t/jest-testcases-failing-after-appolo-server-express-upgrade-from-v2-to-v3/7939 "2024-11-11T09:49:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sailesh](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/sailesh/32/5358_2.png) [@sailesh](https://community.apollographql.com/u/sailesh)\
**Post date:** [November 11, 2024, 9:49am UTC](https://community.apollographql.com/t/jest-testcases-failing-after-appolo-server-express-upgrade-from-v2-to-v3/7939/1 "2024-11-11T09:49:54Z")

</div>

Getting the below error when using executeOperation of v3:

```auto
Cannot use GraphQLObjectType "Query" 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.

```

Overriding the graphql version in overrides section of package.json didn’t work.  
npm ls graphql gives the same version in all dependencies & their sub-dependencies.

The dev server is running fine. Issue is happening only during running the jest testcases and the error is thrown from the line where I call executeOperation. Attaching the callstack below:

```auto
at instanceOf (node_modules/graphql/jsutils/instanceOf.js:35:13)
      at isObjectType (node_modules/graphql/type/definition.js:122:34)
      at isCompositeType (node_modules/graphql/type/definition.js:264:10)
          at Array.filter (<anonymous>)
      at Object.serverWillStart (node_modules/apollo-server-core/src/plugin/cacheControl/index.ts:86:68)
      at node_modules/apollo-server-core/src/ApolloServer.ts:444:55
          at Array.map (<anonymous>)
      at ApolloServer._start (node_modules/apollo-server-core/src/ApolloServer.ts:442:24)
      at ApolloServer.executeOperation (node_modules/apollo-server-core/src/ApolloServer.ts:998:7)

```

Versions:  
“apollo-server-express”: “^3.13.0”  
“graphql”: “^15.3.0”,

If anyone has faced similar scenarios, please help

---

<div class="post-metadata">

**Author:** ![sailesh](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/sailesh/32/5358_2.png) [@sailesh](https://community.apollographql.com/u/sailesh)\
**Post date:** [November 11, 2024, 10:45am UTC](https://community.apollographql.com/t/jest-testcases-failing-after-appolo-server-express-upgrade-from-v2-to-v3/7939/2 "2024-11-11T10:45:30Z")

</div>

Output of npm ls graphql

```auto
├─┬ apollo-datasource-rest@0.6.11
│ └─┬ apollo-server-errors@2.5.0
│ └── graphql@15.9.0 deduped
├─┬ apollo-server-express@3.13.0
│ ├─┬ apollo-server-core@3.13.0
│ │ ├─┬ @apollo/utils.usagereporting@1.0.1
│ │ │ ├─┬ @apollo/utils.dropunuseddefinitions@1.1.0
│ │ │ │ └── graphql@15.9.0 deduped
│ │ │ ├─┬ @apollo/utils.printwithreducedwhitespace@1.1.0
│ │ │ │ └── graphql@15.9.0 deduped
│ │ │ ├─┬ @apollo/utils.removealiases@1.0.0
│ │ │ │ └── graphql@15.9.0 deduped
│ │ │ ├─┬ @apollo/utils.sortast@1.1.0
│ │ │ │ └── graphql@15.9.0 deduped
│ │ │ ├─┬ @apollo/utils.stripsensitiveliterals@1.2.0
│ │ │ │ └── graphql@15.9.0 deduped
│ │ │ └── graphql@15.9.0 deduped
│ │ ├─┬ @apollographql/apollo-tools@0.5.4
│ │ │ └── graphql@15.9.0 deduped
│ │ ├─┬ @graphql-tools/mock@8.7.20
│ │ │ ├─┬ @graphql-tools/schema@9.0.19
│ │ │ │ ├─┬ @graphql-tools/merge@8.4.2
│ │ │ │ │ └── graphql@15.9.0 deduped
│ │ │ │ └── graphql@15.9.0 deduped
│ │ │ ├─┬ @graphql-tools/utils@9.2.1
│ │ │ │ ├─┬ @graphql-typed-document-node/core@3.2.0
│ │ │ │ │ └── graphql@15.9.0 deduped
│ │ │ │ └── graphql@15.9.0 deduped
│ │ │ └── graphql@15.9.0 deduped
│ │ ├─┬ @graphql-tools/schema@8.5.1
│ │ │ ├─┬ @graphql-tools/merge@8.3.1
│ │ │ │ ├─┬ @graphql-tools/utils@8.9.0
│ │ │ │ │ └── graphql@15.9.0 deduped
│ │ │ │ └── graphql@15.9.0 deduped
│ │ │ ├─┬ @graphql-tools/utils@8.9.0
│ │ │ │ └── graphql@15.9.0 deduped
│ │ │ └── graphql@15.9.0 deduped
│ │ ├─┬ apollo-server-errors@3.3.1
│ │ │ └── graphql@15.9.0 deduped
│ │ └── graphql@15.9.0 deduped
│ ├─┬ apollo-server-types@3.8.0
│ │ └── graphql@15.9.0 deduped
│ └── graphql@15.9.0 deduped
├─┬ apollo-server-plugin-response-cache@3.8.2
│ ├─┬ apollo-server-plugin-base@3.7.2
│ │ └── graphql@15.9.0 deduped
│ └── graphql@15.9.0 deduped
├─┬ apollo-server-testing@2.25.3
│ ├─┬ apollo-server-core@2.26.2
│ │ ├─┬ @apollographql/graphql-upload-8-fork@8.1.4
│ │ │ └── graphql@15.9.0 deduped
│ │ ├─┬ apollo-cache-control@0.15.0
│ │ │ ├─┬ apollo-server-plugin-base@0.14.0
│ │ │ │ ├─┬ apollo-server-types@0.10.0
│ │ │ │ │ └── graphql@15.9.0 deduped
│ │ │ │ └── graphql@15.9.0 deduped
│ │ │ └── graphql@15.9.0 deduped
│ │ ├─┬ apollo-graphql@0.9.7
│ │ │ └── graphql@15.9.0 deduped
│ │ ├─┬ apollo-server-plugin-base@0.14.0
│ │ │ └── graphql@15.9.0 deduped
│ │ ├─┬ apollo-server-types@0.10.0
│ │ │ └── graphql@15.9.0 deduped
│ │ ├─┬ apollo-tracing@0.16.0
│ │ │ ├─┬ apollo-server-plugin-base@0.14.0
│ │ │ │ ├─┬ apollo-server-types@0.10.0
│ │ │ │ │ └── graphql@15.9.0 deduped
│ │ │ │ └── graphql@15.9.0 deduped
│ │ │ └── graphql@15.9.0 deduped
│ │ ├─┬ graphql-extensions@0.16.0
│ │ │ ├─┬ apollo-server-types@0.10.0
│ │ │ │ └── graphql@15.9.0 deduped
│ │ │ └── graphql@15.9.0 deduped
│ │ ├─┬ graphql-tools@4.0.8
│ │ │ ├─┬ apollo-link@1.2.14
│ │ │ │ └── graphql@15.9.0 deduped
│ │ │ ├─┬ apollo-utilities@1.3.4
│ │ │ │ └── graphql@15.9.0 deduped
│ │ │ └── graphql@15.9.0 deduped
│ │ ├── graphql@15.9.0 deduped
│ │ └─┬ subscriptions-transport-ws@0.9.19
│ │ └── graphql@15.9.0 deduped
│ └── graphql@15.9.0 deduped
├─┬ graphql-tag@2.12.6
│ └── graphql@15.9.0 deduped
├─┬ graphql-type-json@0.3.2
│ └── graphql@15.9.0 deduped
└── graphql@15.9.0

```
