# How to make apollo server and gateway use graphql@17?

**URL:** <https://community.apollographql.com/t/how-to-make-apollo-server-and-gateway-use-graphql-17/5643>\
**Category:** Server\
**Tags:** server, federation\
**Created:** [February 6, 2023, 12:39pm UTC](https://community.apollographql.com/t/how-to-make-apollo-server-and-gateway-use-graphql-17/5643 "2023-02-06T12:39:54Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dulguun\_Otgon](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/dulguun_otgon/32/4069_2.png) [@Dulguun\_Otgon](https://community.apollographql.com/u/Dulguun_Otgon)\
**Post date:** [February 6, 2023, 12:39pm UTC](https://community.apollographql.com/t/how-to-make-apollo-server-and-gateway-use-graphql-17/5643/1 "2023-02-06T12:39:54Z")

</div>

I’m trying to test out `@defer`/`incremental delivery feature`. The documentation said it requries `graphql@17`. So, I added `"graphql": "^17"` to my `dependencies`. But `npm install` gives me this error.

```auto
npm ERR! Found: graphql@undefined
npm ERR! node_modules/graphql
npm ERR! graphql@"^17" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer graphql@"^16.6.0" from @apollo/server@4.3.2
npm ERR! node_modules/@apollo/server
npm ERR! @apollo/server@"^4.3.2" from the root project

```

---

<div class="post-metadata">

**Author:** ![kyleo](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/kyleo/32/2547_2.png) [@kyleo](https://community.apollographql.com/u/kyleo)\
**Post date:** [February 6, 2023, 2:57pm UTC](https://community.apollographql.com/t/how-to-make-apollo-server-and-gateway-use-graphql-17/5643/2 "2023-02-06T14:57:15Z")

</div>

Hey there @Dulguun_Otgon,

[@defer is supported on Apollo Router](https://www.apollographql.com/docs/router/executing-operations/defer-support/), starting with version 1.8. This unfortunately doesn’t include Apollo Server.

**Edit: I was mistaken! Please see Trevor’s answer below.**

---

<div class="post-metadata">

**Author:** ![Dulguun\_Otgon](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/dulguun_otgon/32/4069_2.png) [@Dulguun\_Otgon](https://community.apollographql.com/u/Dulguun_Otgon)\
**Post date:** [February 6, 2023, 4:27pm UTC](https://community.apollographql.com/t/how-to-make-apollo-server-and-gateway-use-graphql-17/5643/3 "2023-02-06T16:27:33Z")

</div>

Does `@apollo/gateway` support this feature as well?

---

<div class="post-metadata">

**Author:** ![trevor.scheer](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/trevor.scheer/32/5669_2.png) [@trevor.scheer](https://community.apollographql.com/u/trevor.scheer)\
**Post date:** [February 6, 2023, 6:06pm UTC](https://community.apollographql.com/t/how-to-make-apollo-server-and-gateway-use-graphql-17/5643/4 "2023-02-06T18:06:20Z")

</div>

@Dulguun_Otgon - in order to use defer and graphql v17 with Apollo Server you have to “force” install it using the npm `--legacy-peer-deps` flag like so:

```auto
npm i --legacy-peer-deps graphql@alpha

```

---

<div class="post-metadata">

**Author:** ![Dulguun\_Otgon](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/dulguun_otgon/32/4069_2.png) [@Dulguun\_Otgon](https://community.apollographql.com/u/Dulguun_Otgon)\
**Post date:** [February 7, 2023, 5:15am UTC](https://community.apollographql.com/t/how-to-make-apollo-server-and-gateway-use-graphql-17/5643/5 "2023-02-07T05:15:04Z")

</div>

Is it about the server or gateway? I’ve tried what you suggested but I get the unknown directive error.  
I think `--legacy-peer-deps` option still lets other packages use what they specified in their `peerDependencies`.

Another question. Will Apollo gateway and server support @defer in the future without force installing dependencies?

---

<div class="post-metadata">

**Author:** ![Dulguun\_Otgon](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/dulguun_otgon/32/4069_2.png) [@Dulguun\_Otgon](https://community.apollographql.com/u/Dulguun_Otgon)\
**Post date:** [February 7, 2023, 5:51am UTC](https://community.apollographql.com/t/how-to-make-apollo-server-and-gateway-use-graphql-17/5643/6 "2023-02-07T05:51:34Z")

</div>

Even this doesn’t work for me

```json
{
  "name": "experiments",
  "private": true,
  "workspaces": [
    "packages/*"
  ],
  "dependencies": {
    "@apollo/gateway": "^2.3.0",
    "@apollo/server": "^4.3.2",
    "@apollo/subgraph": "^2.3.0",
    "graphql": "^17.0.0-alpha.2",
    // other dependencies
  },
  "overrides" : {
    "graphql" : "$graphql"
  }
}

```

---

<div class="post-metadata">

**Author:** ![trevor.scheer](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/trevor.scheer/32/5669_2.png) [@trevor.scheer](https://community.apollographql.com/u/trevor.scheer)\
**Post date:** [February 7, 2023, 4:09pm UTC](https://community.apollographql.com/t/how-to-make-apollo-server-and-gateway-use-graphql-17/5643/7 "2023-02-07T16:09:55Z")

</div>

Apollo Gateway will never support defer, but Router does (with some caveats). Apollo Server on its own (no federation) does support defer, and will eventually support it without any workarounds once graphql v17 is generally available.

---

<div class="post-metadata">

**Author:** ![Dulguun\_Otgon](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/dulguun_otgon/32/4069_2.png) [@Dulguun\_Otgon](https://community.apollographql.com/u/Dulguun_Otgon)\
**Post date:** [February 8, 2023, 3:47am UTC](https://community.apollographql.com/t/how-to-make-apollo-server-and-gateway-use-graphql-17/5643/8 "2023-02-08T03:47:49Z")

</div>

Thank you. I’ve decided to migrate to router.

What are the caveats you mentioned? Detailed info on that would be really useful to me in the future.

---

<div class="post-metadata">

**Author:** ![trevor.scheer](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/trevor.scheer/32/5669_2.png) [@trevor.scheer](https://community.apollographql.com/u/trevor.scheer)\
**Post date:** [February 8, 2023, 5:42pm UTC](https://community.apollographql.com/t/how-to-make-apollo-server-and-gateway-use-graphql-17/5643/9 "2023-02-08T17:42:18Z")

</div>

I would recommend reading the [docs page](https://www.apollographql.com/docs/router/executing-operations/defer-support/) for that so you’ve got the full picture.
