如何使用托管联盟设置Apollo网关?

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

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

  2. 为什么即使在阿波罗服务器说 Gateway成功加载架构后,GraphQL架构仍未定义。

我知道这种情况在其他情况下会产生冲突,在其他情况下,在将承诺传递给另一个函数或构造函数之前,该承诺没有得到解决。我需要以某种方式等待ApolloGateway来获取所有服务,然后再将其传递给ApolloServer吗?我该怎么办?

[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)
yonghuzhuxiao 回答:如何使用托管联盟设置Apollo网关?

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3159723.html

大家都在问