# Setup Apollo server v4 with apollo gateway and graphql-modules

**URL:** <https://community.apollographql.com/t/setup-apollo-server-v4-with-apollo-gateway-and-graphql-modules/6949>\
**Category:** Server\
**Tags:** server, federation\
**Created:** [November 16, 2023, 9:34am UTC](https://community.apollographql.com/t/setup-apollo-server-v4-with-apollo-gateway-and-graphql-modules/6949 "2023-11-16T09:34:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ParkerTran](https://avatars.discourse-cdn.com/v4/letter/p/858c86/32.png) [@ParkerTran](https://community.apollographql.com/u/ParkerTran)\
**Post date:** [November 16, 2023, 9:34am UTC](https://community.apollographql.com/t/setup-apollo-server-v4-with-apollo-gateway-and-graphql-modules/6949/1 "2023-11-16T09:34:57Z")

</div>

I have try to setup apollo server with apollo gateway and graphql-module.  
This is my repo of this setup: [Graphql Demo](https://github.com/ParkerTran/graphql-demo)  
The server is running success but problem come when call api.  
My resolver

```auto
Query: {
    me() {
      return { id: '1', username: '@ava' };
    },
  },

```

My API call response:

 ![image](https://us1.discourse-cdn.com/flex019/uploads/apollographql/original/2X/7/76335b42b022c40fc006fcb06ef2505cdfc4be07.png)  
The return value for API me is null. But it should return { id: ‘1’, username: ‘@ava’ }.  
Could you pls take a look on this and give me an advice? Thank you so much.

---

<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:** [November 16, 2023, 3:34pm UTC](https://community.apollographql.com/t/setup-apollo-server-v4-with-apollo-gateway-and-graphql-modules/6949/2 "2023-11-16T15:34:05Z")

</div>

> [@ParkerTran](#):
>
> or API me is null. But it should return { id: ‘1’, username: ‘@ava’ }.  
> Could you pls take a look on this and give me an advice? Thank you so muc

You’re creating two separate subgraph schemas. It looks like it was correct before. If you uncomment `subgraphSchema` and remove the call to `buildSubgraphSchema` here it works.

> <https://github.com/ParkerTran/graphql-demo/blob/88490783720afc11aa923ee77c75a3532dd6fd48/src/main.ts#L104-L110>

---

<div class="post-metadata">

**Author:** ![ParkerTran](https://avatars.discourse-cdn.com/v4/letter/p/858c86/32.png) [@ParkerTran](https://community.apollographql.com/u/ParkerTran)\
**Post date:** [November 16, 2023, 5:06pm UTC](https://community.apollographql.com/t/setup-apollo-server-v4-with-apollo-gateway-and-graphql-modules/6949/3 "2023-11-16T17:06:48Z")

</div>

Thank you for reply.

I would like to add [Graphql Module](https://the-guild.dev/graphql/modules) to this setup. So i use buildSubgraphSchema to build schema from typedefs and resolver from config of graphql module.

---

<div class="post-metadata">

**Author:** ![Justin\_Gonzalez](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/justin_gonzalez/32/5359_2.png) [@Justin\_Gonzalez](https://community.apollographql.com/u/Justin_Gonzalez)\
**Post date:** [February 6, 2025, 8:47pm UTC](https://community.apollographql.com/t/setup-apollo-server-v4-with-apollo-gateway-and-graphql-modules/6949/4 "2025-02-06T20:47:57Z")

</div>


