ApolloGateway do not query Subgraph

Hello,

My ApolloGateway do not query my subgraph and i dont get any error from the graphql response or on my service logs so i have no clue about where this error come from.

I have a supergraph endpoint using ApolloGateway in local.
ApolloGateway has the following configuration :

federation_version: 2
subgraphs:
accounts:
routing_url: http://172.17.0.1:8000
schema:
file: …/gruion_subgraph_account/src/accounts.graphql
organization:
routing_url: http://172.17.0.1:8001
schema:
file: …/gruion_subgraph_organization/src/organizations.graphql
user:
routing_url: http://172.17.0.1:8003
schema:
file: …/gruion_subgraph_user/src/users.graphql

and the code (should be standard):

const supergraphSdl = readFileSync(‘./src/supergraph.graphql’).toString() //it is the file above
const gateway = new ApolloGateway({
supergraphSdl,
});
const {schema, executor} = await gateway.load();
const app = express();
const httpServer = http.createServer(app);

const server = new ApolloServer({
schema,
csrfPrevention: false,
executor,
});
await server.start();
app.use(
‘/’,
json(),
expressMiddleware(server )
);

let port = 4000
await new Promise((resolve) => httpServer.listen({ port: port }, resolve));

console.log(🚀 Server ready at http://localhost:${port}/);

I have my subgraph that has a query define like :

type Query {
getAccountName:String
}

And resolved like :

getAccountName() {
return “MyACcountName”
}

when I query the above query to the subgraph server directly(accounts), the query get resolved and answers “MyACcountName” :

curl --location --request POST ‘http://172.17.0.1:8000’ --header ‘Content-Type: application/json’ --data-raw ‘{“query”:“query Query {\n getAccountName\n}”,“variables”:{}}’
{“data”:{“getAccountName”:“MyACcountName”}}

when I query the above query to the supergraph server, the query is not sent to the subgraph so it does not resolve it and answers null :

curl --location --request POST ‘http://172.17.0.1:8002’ --header ‘Content-Type: application/json’ --data-raw ‘{“query”:“query Query {\n getAccountName\n}”,“variables”:{}}’
{“data”:{“getAccountName”:null}}

Where the issue can come from?
Is there a way to enable verbose logs on supergraph server and subgraph?
I tried to follow different documentation to enable logs on my servers but nothing works

I have found the issue. To fix this issue you have to remove :

const {schema, executor} = await gateway.load();

so the code will be :

const supergraphSdl = readFileSync(‘./src/supergraph.graphql’).toString() //it is the file above
const gateway = new ApolloGateway({
supergraphSdl,
});
const app = express();
const httpServer = http.createServer(app);

const server = new ApolloServer({
gateway,
csrfPrevention: false,
});
await server.start();
app.use(
‘/’,
json(),
expressMiddleware(server )
);

let port = 4000
await new Promise((resolve) => httpServer.listen({ port: port }, resolve));

console.log(🚀 Server ready at http://localhost:${port}/);