【问题标题】:Apollo Federations阿波罗联盟
【发布时间】:2021-12-28 05:17:16
【问题描述】:

我正在学习 GraphQL Federations 中非常基础的教程并尝试运行 Apollo 服务器 如下:

const { ApolloServer } = require("apollo-server");
const { ApolloGateway } = require("@apollo/gateway");

const gateway = new ApolloGateway({
    serviceList: [
        { name: "integrations", url: "http://localhost:5000/integrations" },
        // List of federation-capable GraphQL endpoints...
    ]
});

const server = new ApolloServer({ gateway });

server.listen().then(({ url }) => {
    console.log(`???? Server ready at ${url}`);
});

但我经常遇到Class constructor GraphQLNonNull cannot be invoked without 'new' 的错误。我检查了 git repo 中的打开/关闭问题,似乎没有人遇到类似的问题。

我的节点版本是 v14.15.1 我的 npm 库版本:

"@apollo/gateway": "^0.44.0",
"apollo-server": "^3.5.0",
"graphql": "^16.0.1"

如果我能从任何人那里得到任何线索,我将不胜感激,干杯。

【问题讨论】:

  • 你能添加你的 tsconfig 吗?
  • 嗨,Timon,我使用的是纯 js。

标签: node.js graphql


【解决方案1】:

问题恰好来自 graphql 的版本。我将其降级为 graphql 15.0.0 一切正常。

【讨论】:

    猜你喜欢
    • 2019-12-09
    • 2021-10-21
    • 2020-07-17
    • 2022-01-21
    • 2021-01-05
    • 2021-06-01
    • 2013-02-02
    • 2017-10-15
    • 2021-09-09
    相关资源
    最近更新 更多