3

在阅读了有关托管联合的 Apollo 文档后,我完全按照文章中的描述配置了我的 Apollo 网关。基本上我没有将任何东西传递给ApolloGateway构造函数。它ENGINE_API_KEY在我的 .env 文件中提供,应该由 ApolloGateway 实例获取。

  1. 这个第一个警告是什么意思?如果没有可用的架构更新,该消息是否正常和预期?

  2. 为什么即使在 apollo-server sais Gateway 成功加载架构之后,GraphQL 架构仍未定义。?

我知道在传递给另一个函数或构造函数之前未解决承诺的其他情况下会出现这种冲突的输出。在将所有服务传递给 ApolloServer 之前,我是否必须以某种方式等待 ApolloGateway 获取所有服务?我应该如何最好地做到这一点?

[WARN] Tue Nov 05 2019 12:58:26 GMT+0100 (GMT+01:00) apollo-gateway: Error checking for schema updates. Falling back to existing schema. Error: When `serviceList` is not set, an Apollo Engine configuration must be provided. See https://www.apollographql.com/docs/apollo-server/federation/managed-federation/ for more information.
    at ApolloGateway.<anonymous> (e:\OneDrive\Dokumente\Projekte\BLEND-LMS\server\API\node_modules\@apollo\gateway\src\index.ts:464:13)
    at Generator.next (<anonymous>)
    at e:\OneDrive\Dokumente\Projekte\BLEND-LMS\server\API\node_modules\@apollo\gateway\dist\index.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (e:\OneDrive\Dokumente\Projekte\BLEND-LMS\server\API\node_modules\@apollo\gateway\dist\index.js:4:12)
    at ApolloGateway.loadServiceDefinitions (e:\OneDrive\Dokumente\Projekte\BLEND-LMS\server\API\node_modules\@apollo\gateway\dist\index.js:260:16)
    at ApolloGateway.<anonymous> (e:\OneDrive\Dokumente\Projekte\BLEND-LMS\server\API\node_modules\@apollo\gateway\src\index.ts:285:27)
    at Generator.next (<anonymous>)
    at e:\OneDrive\Dokumente\Projekte\BLEND-LMS\server\API\node_modules\@apollo\gateway\dist\index.js:8:71
    at new Promise (<anonymous>)
[INFO] Tue Nov 05 2019 12:58:26 GMT+0100 (GMT+01:00) apollo-gateway: Gateway successfully loaded schema.
        * Mode: managed
� Server ready at http://localhost:4000/
(node:9836) UnhandledPromiseRejectionWarning: Error: Expected undefined to be a GraphQL schema.
    at assertSchema (e:\OneDrive\Dokumente\Projekte\BLEND-LMS\server\API\node_modules\graphql\type\schema.js:41:11)
    at validateSchema (e:\OneDrive\Dokumente\Projekte\BLEND-LMS\server\API\node_modules\graphql\type\validate.js:44:28)
    at assertValidSchema (e:\OneDrive\Dokumente\Projekte\BLEND-LMS\server\API\node_modules\graphql\type\validate.js:68:16)
    at assertValidExecutionArguments (e:\OneDrive\Dokumente\Projekte\BLEND-LMS\server\API\node_modules\graphql\execution\execute.js:136:35)
    at executeImpl (e:\OneDrive\Dokumente\Projekte\BLEND-LMS\server\API\node_modules\graphql\execution\execute.js:86:3)
    at Object.execute (e:\OneDrive\Dokumente\Projekte\BLEND-LMS\server\API\node_modules\graphql\execution\execute.js:64:63)
    at Object.generateSchemaHash (e:\OneDrive\Dokumente\Projekte\BLEND-LMS\server\API\node_modules\apollo-server-core\src\utils\schemaHash.ts:11:18)
    at ApolloServer.generateSchemaDerivedData (e:\OneDrive\Dokumente\Projekte\BLEND-LMS\server\API\node_modules\apollo-server-core\src\ApolloServer.ts:486:24)
    at e:\OneDrive\Dokumente\Projekte\BLEND-LMS\server\API\node_modules\apollo-server-core\src\ApolloServer.ts:366:14
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(node:9836) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:9836) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.      
(node:9836) PromiseRejectionHandledWarning: Promise rejection was handled asynchronously (rejection id: 2)
4

0 回答 0