Hotchocolate graphql 未在 Apollo Federation 下作为子图运行
我正在尝试使用 .net 5.0 将 hotchocolate 12 子图添加到我现有的 Apollo 联邦中。不幸收到
(node:27900) UnhandledPromiseRejectionWarning: Error: Couldn't load service definitions for "supplier" at http://localhost:3003/graphql: 400: Bad Request
at C:\dev\git\dev.to\graphql.net-in-apollo-federation\federation-gateway\node_modules\@apollo\gateway\src\supergraphManagers\IntrospectAndCompose\loadSer at C:\dev\git\dev.to\graphql.net-in-apollo-federation\federation-gateway\node_modules\@apollo\gateway\src\supergraphManagers\Introsp
vicesFromRemoteEndpoint.ts:77:15
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async Promise.all (index 0)
at loadServicesFromRemoteEndpoint (C:\dev\git\dev.to\graphql.net-in-apollo-federation\federation-gateway\node_modules\@apollo\gateway\src\supergraphManagy\src\supergraphManagers\IntrospectAndCompose\loadServicesFromRemoteEndpoint.ts:81:30)
csprojstartup.cs
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="graphiql" Version="2.0.0" />
<PackageReference Include="HotChocolate.Abstractions" Version="12.6.2" />
<PackageReference Include="HotChocolate.AspNetCore" Version="12.6.2" />
<PackageReference Include="HotChocolate.ApolloFederation" Version="12.6.2" />
</ItemGroup>
</Project>
;
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services
.AddGraphQLServer()
.AddApolloFederation()
.AddQueryType<Query>();
services.AddGraphiQl(x =>
{
x.GraphiQlPath = "/graphiql-ui";
x.GraphQlApiPath = "/graphql";
});
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
{
app.UseGraphiQl();
app.UseRouting();
app.UseEndpoints(endpoints =>
{
endpoints.MapGraphQL();
});
}
示例项目 https://github.com/killjoy2013/hotchocolate-apollo-federation
什么我失踪了吗?
I'm trying to add a hotchocolate 12 subgraph to my existing Apollo federation using .net 5.0. Unfortunately receiving
(node:27900) UnhandledPromiseRejectionWarning: Error: Couldn't load service definitions for "supplier" at http://localhost:3003/graphql: 400: Bad Request
at C:\dev\git\dev.to\graphql.net-in-apollo-federation\federation-gateway\node_modules\@apollo\gateway\src\supergraphManagers\IntrospectAndCompose\loadSer at C:\dev\git\dev.to\graphql.net-in-apollo-federation\federation-gateway\node_modules\@apollo\gateway\src\supergraphManagers\Introsp
vicesFromRemoteEndpoint.ts:77:15
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async Promise.all (index 0)
at loadServicesFromRemoteEndpoint (C:\dev\git\dev.to\graphql.net-in-apollo-federation\federation-gateway\node_modules\@apollo\gateway\src\supergraphManagy\src\supergraphManagers\IntrospectAndCompose\loadServicesFromRemoteEndpoint.ts:81:30)
csproj
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="graphiql" Version="2.0.0" />
<PackageReference Include="HotChocolate.Abstractions" Version="12.6.2" />
<PackageReference Include="HotChocolate.AspNetCore" Version="12.6.2" />
<PackageReference Include="HotChocolate.ApolloFederation" Version="12.6.2" />
</ItemGroup>
</Project>
startup.cs;
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services
.AddGraphQLServer()
.AddApolloFederation()
.AddQueryType<Query>();
services.AddGraphiQl(x =>
{
x.GraphiQlPath = "/graphiql-ui";
x.GraphQlApiPath = "/graphql";
});
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory)
{
app.UseGraphiQl();
app.UseRouting();
app.UseEndpoints(endpoints =>
{
endpoints.MapGraphQL();
});
}
Sample project https://github.com/killjoy2013/hotchocolate-apollo-federation
What am I missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论