Node.js `Extensions`字段未显示在apollo graphql响应数据中

Node.js `Extensions`字段未显示在apollo graphql响应数据中,node.js,express,graphql,apollo,apollo-server,Node.js,Express,Graphql,Apollo,Apollo Server,这是一本书。运行app.js并在 您可以运行如下查询: query RecipeQuery{ recipe(title:"Recipe 2"){ description } } 问题: 我需要从响应数据中的extensions字段中获取调试信息。我说的是这个扩展字段: "data":{....}, "extensions": { "tracing": {} "cacheControl":{} } 但实际上,我只得到了数据字段: "data":{

这是一本书。运行
app.js
并在

您可以运行如下查询:

query RecipeQuery{
  recipe(title:"Recipe 2"){
    description
  }
}
问题:

我需要从响应数据中的
extensions
字段中获取调试信息。我说的是这个
扩展
字段:

  "data":{....},
  "extensions": {
    "tracing": {}
    "cacheControl":{}
  }
但实际上,我只得到了数据字段:

  "data":{....}
我已经在apollo服务器配置中启用了
跟踪
缓存控制
,但是
扩展
字段仍然被排除在响应数据之外。如何取回
扩展名
数据

以下是阿波罗引擎的启动方式:

const expressApp = express();

const server = new ApolloServer({
    schema,
    tracing: true,
    cacheControl: true,
    engine: false, // we will provide our own ApolloEngine
});

server.applyMiddleware({ app: expressApp });

const engine = new ApolloEngine({
    apiKey: "YOUR_ID",

});

engine.listen(
    {
        port,
        expressApp,
        graphqlPaths: [graphqlEndpointPath],
    },
    () => console.log(`Server with Apollo Engine is running on http://localhost:${port}`),
);
依赖关系

  "dependencies": {
    "apollo-cache-control": "^0.1.1",
    "apollo-engine": "^1.1.2",
    "apollo-server-express": "^2.2.2",
    "graphql-depth-limit": "^1.1.0",
    "graphql-yoga": "^1.16.7",
    "type-graphql": "^0.15.0"
  }

您可以使用
formatResponse
格式化apollo的响应

const server = new ApolloServer({
  typeDefs,
  resolvers,
  formatResponse: response => {
    console.log(response); 
    /* 
    ** { data } with informations such as queryType,
    ** directives ...
    ** I guess there is also the extensions key 
    */
    return response;
  }
});

完成后,apollo最近重建了他们的整个文档(破坏了许多URL):