ChilliCream / graphql-platform

Welcome to the home of the Hot Chocolate GraphQL server for .NET, the Strawberry Shake GraphQL client for .NET and Banana Cake Pop the awesome Monaco based GraphQL IDE.
https://chillicream.com
MIT License
5.03k stars 723 forks source link

Your service provider may not support keyed services for HotChocolate.Stitching.Redis 13.9.0 in dotnet aspire #7029

Open gpproton opened 2 months ago

gpproton commented 2 months ago

Product

Hot Chocolate

Version

13.9.0

Link to minimal reproduction

https://github.com/gpproton/hotchocolate-aspire

Environment:

windows 11 vscode .NET 8.0 Aspire webapi redis

Steps to reproduce

Added the line below after setting up dependent services.

builder.Services
    .AddGraphQLServer()
    .AddQueryType(d => d.Name("Query"))
    .AddRemoteSchemasFromRedis("Demo", sp => sp.GetRequiredService<IConnectionMultiplexer>());

What is expected?

To setup a graphql gateway using federation with Redis and this was working fine before dotnet aspire preview 4.

What is actually happening?

The other services work fine except for the gateway service when using AddRemoteSchemasFromRedis for schema stitching.

Relevant log output

Unhandled exception. System.InvalidOperationException: This service descriptor is keyed. Your service provider may not support keyed services.
   at Microsoft.Extensions.DependencyInjection.ServiceDescriptor.ThrowKeyedDescriptor()
   at Microsoft.Extensions.DependencyInjection.ServiceDescriptor.get_ImplementationType()
   at Microsoft.Extensions.DependencyInjection.HotChocolateStitchingRedisRequestExecutorBuilderExtensions.<>c.<AddRemoteSchemasFromRedis>b__0_2(ServiceDescriptor t)
   at System.Linq.Enumerable.All[TSource](IEnumerable`1 source, Func`2 predicate)
   at Microsoft.Extensions.DependencyInjection.HotChocolateStitchingRedisRequestExecutorBuilderExtensions.AddRemoteSchemasFromRedis(IRequestExecutorBuilder builder, String configurationName, Func`2 connectionFactory)
   at Program.<Main>$(String[] args) in D:\sandbox\hotchocolate-aspire\hotchocolate-aspire.ApiGateway\Program.cs:line 16

Additional context

Alsoo tried with version 13.5.0 and above except 14.0.0 since no version is available for HotChocolate.Stitching.Redis

Screenshot_28-3-2024_194924_localhost Screenshot_28-3-2024_194947_localhost