在 NX monorepo 中,我正在构建 3 个 Nestjs 应用程序,首先是一个auth-service+user-service和一个。gateway它们均由 apollo graphql 提供支持并遵循官方 Nestjs 文档。
我遇到的问题是,在user-service作为auth-service单独服务器成功处理请求的同时,网关抛出
Couldn't load service definitions for "auth" at http://localhost:3100/apis/auth-service/graphql: 400: Bad Request
Run Code Online (Sandbox Code Playgroud)
这些服务本身是标准的 graphql 应用程序,没有什么基础的。
网关的定义如下:
{
server: {
debug: true,
playground: true,
autoSchemaFile: './apps/gateway/schema.gql',
sortSchema: true,
introspection: true,
cors: ['*'],
path: '/apis/gateway/graphql';
},
gateway: {
supergraphSdl: new IntrospectAndCompose({
subgraphHealthCheck: true,
subgraphs: [
{
name: 'user',
url: resolveSubgraphUrl('user'),
},
{
name: 'auth',
url: resolveSubgraphUrl('auth'),
},
],
}), …Run Code Online (Sandbox Code Playgroud) graphql nestjs apollo-federation graphql-federation nestjs-graphql