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.26k stars 746 forks source link

Error downloading schema when initializing client. #4207

Closed Elvarorn closed 2 years ago

Elvarorn commented 3 years ago

Is there an existing issue for this?

Describe the bug

When i initialize a new client, dotnet graphql init https://api-eu-central-1.graphcms.com/v2/cktbkxgub0po301xqblaser1r/master -n TestClient

it downloads the schema then throws Unhandled exception. System.InvalidOperationException: Sequence contains no matching element. I expected it to download the schema and then add the new client to the project

Steps to reproduce

  1. Add the Strawberry Shake CLI tools
  2. Install the required packages
  3. Add a GraphQL client to your project using the CLI tools with url https://api-eu-central-1.graphcms.com/v2/cktbkxgub0po301xqblaser1r/master - ERROR

Relevant log output

Download schema started.
Download schema completed in 1109 ms
Unhandled exception. System.InvalidOperationException: Sequence contains no matching element
   at System.Linq.ThrowHelper.ThrowNoMatchException()
   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source, Func`2 predicate)
   at HotChocolate.Utilities.Introspection.SchemaFeatures.FromIntrospectionResult(IntrospectionResult result) in /home/vsts/work/1/s/src/HotChocolate/Utilities/src/Utilities.Introspection/SchemaFeatures.cs:line 27
   at HotChocolate.Utilities.Introspection.IntrospectionClient.GetSchemaFeaturesAsync(HttpClient client, CancellationToken cancellationToken) in /home/vsts/work/1/s/src/HotChocolate/Utilities/src/Utilities.Introspection/IntrospectionClient.cs:line 97
   at HotChocolate.Utilities.Introspection.IntrospectionClient.DownloadSchemaAsync(HttpClient client, CancellationToken cancellationToken) in /home/vsts/work/1/s/src/HotChocolate/Utilities/src/Utilities.Introspection/IntrospectionClient.cs:line 67
   at HotChocolate.Utilities.Introspection.IntrospectionClient.DownloadSchemaAsync(HttpClient client, Stream stream, CancellationToken cancellationToken) in /home/vsts/work/1/s/src/HotChocolate/Utilities/src/Utilities.Introspection/IntrospectionClient.cs:line 49
   at StrawberryShake.Tools.DefaultFileSystem.WriteToAsync(String fileName, Func`2 write) in /home/vsts/work/1/s/src/StrawberryShake/Tooling/src/dotnet-graphql/DefaultFileSystem.cs:line 81
   at StrawberryShake.Tools.IntrospectionHelper.DownloadSchemaAsync(HttpClient client, IFileSystem fileSystem, IActivity activity, String fileName, CancellationToken cancellationToken) in /home/vsts/work/1/s/src/StrawberryShake/Tooling/src/dotnet-graphql/IntrospectionHelper.cs:line 21
   at StrawberryShake.Tools.InitCommandHandler.DownloadSchemaAsync(InitCommandContext context, CancellationToken cancellationToken) in /home/vsts/work/1/s/src/StrawberryShake/Tooling/src/dotnet-graphql/InitCommandHandler.cs:line 93
   at StrawberryShake.Tools.InitCommandHandler.ExecuteInternalAsync(InitCommandContext context, CancellationToken cancellationToken) in /home/vsts/work/1/s/src/StrawberryShake/Tooling/src/dotnet-graphql/InitCommandHandler.cs:line 65
   at StrawberryShake.Tools.InitCommandHandler.ExecuteAsync(InitCommandArguments arguments, CancellationToken cancellationToken) in /home/vsts/work/1/s/src/StrawberryShake/Tooling/src/dotnet-graphql/InitCommandHandler.cs:line 51
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync(String[] args, CancellationToken cancellationToken)
   at StrawberryShake.Tools.Program.<Main>(String[] args)

Additional Context?

No response

Product

Strawberry Shake

Version

11.3.7

michaelstaib commented 3 years ago

I will have a look at this ... in bcp the schema works fine ... could be a bug.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

jeffward01 commented 2 years ago

I am also having this issue, I have tried a few things and am unable to debug it.

Version: "version": "12.15.0",

Can you help point me in the right direction for debugging?

This is a private endpoint that unfortunately I cannot share

It works fine on some of your 'workshop' or demo queries, but on this particular graphQL endpoint, this is the response. I am guessing it is how the GraphQL server is configured.

I have the schema and query docs, is it possible to manually load them?


Thank you!!

GREAT TOOL!!

Download schema started.
Download schema completed in 884 ms
Unhandled exception. System.InvalidOperationException: Sequence contains no matching element
   at System.Linq.ThrowHelper.ThrowNoMatchException()
   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source, Func`2 predicate)
   at HotChocolate.Utilities.Introspection.SchemaFeatures.FromIntrospectionResult(IntrospectionResult result) in /home/vsts/work/1/s/src/HotChocolate/Utilities/src/Utilities.Introspection/SchemaFeatures.cs:line 27
   at HotChocolate.Utilities.Introspection.IntrospectionClient.GetSchemaFeaturesAsync(HttpClient client, CancellationToken cancellationToken) in /home/vsts/work/1/s/src/HotChocolate/Utilities/src/Utilities.Introspection/IntrospectionClient.cs:line 97
   at HotChocolate.Utilities.Introspection.IntrospectionClient.DownloadSchemaAsync(HttpClient client, CancellationToken cancellationToken) in /home/vsts/work/1/s/src/HotChocolate/Utilities/src/Utilities.Introspection/IntrospectionClient.cs:line 67
   at HotChocolate.Utilities.Introspection.IntrospectionClient.DownloadSchemaAsync(HttpClient client, Stream stream, CancellationToken cancellationToken) in /home/vsts/work/1/s/src/HotChocolate/Utilities/src/Utilities.Introspection/IntrospectionClient.cs:line 49
   at StrawberryShake.Tools.DefaultFileSystem.WriteToAsync(String fileName, Func`2 write) in /home/vsts/work/1/s/src/StrawberryShake/Tooling/src/dotnet-graphql/DefaultFileSystem.cs:line 81
   at StrawberryShake.Tools.IntrospectionHelper.DownloadSchemaAsync(HttpClient client, IFileSystem fileSystem, IActivity activity, String fileName, CancellationToken cancellationToken) in /home/vsts/work/1/s/src/StrawberryShake/Tooling/src/dotnet-graphql/IntrospectionHelper.cs:line 21
   at StrawberryShake.Tools.InitCommandHandler.DownloadSchemaAsync(InitCommandContext context, CancellationToken cancellationToken) in /home/vsts/work/1/s/src/StrawberryShake/Tooling/src/dotnet-graphql/InitCommandHandler.cs:line 92
   at StrawberryShake.Tools.InitCommandHandler.ExecuteInternalAsync(InitCommandContext context, CancellationToken cancellationToken) in /home/vsts/work/1/s/src/StrawberryShake/Tooling/src/dotnet-graphql/InitCommandHandler.cs:line 64
   at StrawberryShake.Tools.InitCommandHandler.ExecuteAsync(InitCommandArguments arguments, CancellationToken cancellationToken) in /home/vsts/work/1/s/src/StrawberryShake/Tooling/src/dotnet-graphql/InitCommandHandler.cs:line 50
   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync(String[] args, CancellationToken cancellationToken)
   at StrawberryShake.Tools.Program.<Main>(String[] args)