Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fusion Subgraph Compose InvalidCastException #6489

Closed
1 task done
ndejaco2 opened this issue Aug 29, 2023 · 3 comments
Closed
1 task done

Fusion Subgraph Compose InvalidCastException #6489

ndejaco2 opened this issue Aug 29, 2023 · 3 comments
Labels
Area: Fusion Issue is related to Hot Chocolate Fusion 🌶️ hot chocolate

Comments

@ndejaco2
Copy link
Contributor

ndejaco2 commented Aug 29, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Product

Hot Chocolate

Describe the bug

I am trying to compose a subgraph into a fusion .fsp file with the following schema:

type Author {
    id: ID!
    reviews: ReviewConnection
}

type Book {
    id: ID!
    reviews: ReviewConnection
}

input CreateReviewInput {
    bookId: ID!
    reviewerId: ID!
    authorId: ID!
    comment: String!
    rating: Int!
}

input DeleteReviewInput {
    id: ID!
}

type Review {
    id: ID!
    bookId: ID!
    reviewerId: ID!
    authorId: ID!
    comment: String!
    rating: Int!
}

type ReviewConnection {
    items: [Review]
    nextToken: String
}


type Mutation {
    createReview(input: CreateReviewInput!): Review
    deleteReview(input: DeleteReviewInput!): Review
}

type Query {
    getReview(id: ID!): Review
    listReviews(limit: Int, nextToken: String): ReviewConnection
    queryReviewsByBook(bookId: ID!, limit: int, nextToken: String): ReviewConnection
    queryReviewsByReviewer(reviewerId: ID!, limit: int, nextToken: String): ReviewConnection
    queryReviewsByAuthor(authorId: ID!, limit: int, nextToken: String): ReviewConnection
}

schema {
    query: Query,
    mutation: Mutation
}

The config file is like the following:

{
    "subgraph": "reviews",
    "http": { "baseAddress": "https://<some-endpoint>/graphql" }
}

I am able to successfully pack the subgraph into reviews.fsp file. However, I am getting the following error when trying to compose the gateway fsp file:

% dotnet fusion compose -p ./fusion-gateway/gateway.fgp -s ./lib/sourceApis/ReviewsService

Unhandled exception: System.InvalidCastException: Unable to cast object of type 'HotChocolate.Skimmed.MissingType' to type 'HotChocolate.Skimmed.ScalarType'.
   at HotChocolate.Fusion.Composition.Pipeline.ScalarTypeMergeHandler.MergeAsync(CompositionContext context, TypeGroup typeGroup, CancellationToken cancellationToken) in /home/runner/work/graphql-platform/graphql-platform/src/HotChocolate/Fusion/src/Composition/Pipeline/MergeHandler/ScalarTypeMergeHandler.cs:line 29
   at HotChocolate.Fusion.Composition.Pipeline.MergeTypeMiddleware.InvokeAsync(CompositionContext context, MergeDelegate next) in /home/runner/work/graphql-platform/graphql-platform/src/HotChocolate/Fusion/src/Composition/Pipeline/MergeTypeMiddleware.cs:line 50
   at HotChocolate.Fusion.Composition.Pipeline.EntityFieldDependencyMiddleware.InvokeAsync(CompositionContext context, MergeDelegate next) in /home/runner/work/graphql-platform/graphql-platform/src/HotChocolate/Fusion/src/Composition/Pipeline/EntityFieldDependencyMiddleware.cs:line 20
   at HotChocolate.Fusion.Composition.Pipeline.MergeEntityMiddleware.InvokeAsync(CompositionContext context, MergeDelegate next) in /home/runner/work/graphql-platform/graphql-platform/src/HotChocolate/Fusion/src/Composition/Pipeline/MergeEntityMiddleware.cs:line 26
   at HotChocolate.Fusion.Composition.Pipeline.PrepareFusionSchemaMiddleware.InvokeAsync(CompositionContext context, MergeDelegate next) in /home/runner/work/graphql-platform/graphql-platform/src/HotChocolate/Fusion/src/Composition/Pipeline/PrepareFusionSchemaMiddleware.cs:line 50
   at HotChocolate.Fusion.Composition.Pipeline.EnrichEntityMiddleware.InvokeAsync(CompositionContext context, MergeDelegate next) in /home/runner/work/graphql-platform/graphql-platform/src/HotChocolate/Fusion/src/Composition/Pipeline/EnrichEntityMiddleware.cs:line 64
   at HotChocolate.Fusion.Composition.Pipeline.ApplyRemoveDirectiveMiddleware.InvokeAsync(CompositionContext context, MergeDelegate next) in /home/runner/work/graphql-platform/graphql-platform/src/HotChocolate/Fusion/src/Composition/Pipeline/ApplyRemoveDirectiveMiddleware.cs:line 29
   at HotChocolate.Fusion.Composition.Pipeline.ApplyRenameDirectiveMiddleware.InvokeAsync(CompositionContext context, MergeDelegate next) in /home/runner/work/graphql-platform/graphql-platform/src/HotChocolate/Fusion/src/Composition/Pipeline/ApplyRenameDirectiveMiddleware.cs:line 36
   at HotChocolate.Fusion.Composition.Pipeline.RegisterClientsMiddleware.InvokeAsync(CompositionContext context, MergeDelegate next) in /home/runner/work/graphql-platform/graphql-platform/src/HotChocolate/Fusion/src/Composition/Pipeline/RegisterClientsMiddleware.cs:line 43
   at HotChocolate.Fusion.Composition.Pipeline.ParseSubgraphSchemaMiddleware.InvokeAsync(CompositionContext context, MergeDelegate next) in /home/runner/work/graphql-platform/graphql-platform/src/HotChocolate/Fusion/src/Composition/Pipeline/ParseSubGraphSchemaMiddleware.cs:line 34
   at HotChocolate.Fusion.Composition.FusionGraphComposer.TryComposeAsync(IEnumerable`1 configurations, FusionFeatureCollection features, CancellationToken cancellationToken) in /home/runner/work/graphql-platform/graphql-platform/src/HotChocolate/Fusion/src/Composition/FusionGraphComposer.cs:line 164
   at HotChocolate.Fusion.CommandLine.Commands.ComposeCommand.ExecuteAsync(IConsole console, FileInfo packageFile, List`1 subgraphPackageFiles, FileInfo settingsFile, DirectoryInfo workingDirectory, Nullable`1 enableNodes, CancellationToken cancellationToken) in /home/runner/work/graphql-platform/graphql-platform/src/HotChocolate/Fusion/src/CommandLine/Commands/ComposeCommand.cs:line 179
   at HotChocolate.Fusion.CommandLine.Commands.ComposeCommand.ExecuteAsync(IConsole console, FileInfo packageFile, List`1 subgraphPackageFiles, FileInfo settingsFile, DirectoryInfo workingDirectory, Nullable`1 enableNodes, CancellationToken cancellationToken) in /home/runner/work/graphql-platform/graphql-platform/src/HotChocolate/Fusion/src/CommandLine/Commands/ComposeCommand.cs:line 202
   at System.CommandLine.Invocation.AnonymousCommandHandler.InvokeAsync(InvocationContext context)
   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass17_0.<<UseParseErrorReporting>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass12_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseVersionOption>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass19_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__18_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<<UseParseDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__5_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass8_0.<<UseExceptionHandler>b__0>d.MoveNext()

Any idea what I am doing wrong?

Steps to reproduce

  1. Create a folder with above schema file and subgraph config.
  2. dotnet tool restore (Note, I am using HotChocolate.Fusion.CommandLine version 13.6.0-preview.2)
  3. dotnet fusion subgraph pack -w ./lib/sourceApis/ReviewsService
  4. dotnet fusion compose -p ./fusion-gateway/gateway.fgp -s ./appsync-infrastructure/lib/sourceApis/ReviewsService

Relevant log output

No response

Additional Context?

No response

Version

13.6.0-preview.2

@tobias-tengler tobias-tengler added 🌶️ hot chocolate Area: Fusion Issue is related to Hot Chocolate Fusion labels Aug 29, 2023
@ndejaco2
Copy link
Contributor Author

The issue was a typo, input argument was int rather than Int :)

@michaelstaib
Copy link
Member

Was at a conference in Copenhagen and could not answer... yes ... for 13.6 we are focusing on the validation story to have better errors.

@michaelstaib
Copy link
Member

#6493

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Fusion Issue is related to Hot Chocolate Fusion 🌶️ hot chocolate
Projects
None yet
Development

No branches or pull requests

3 participants