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

Error with fusion: An item with the same key has already been added, when require the same field on type extension #6993

Open
rowe-stamy opened this issue Mar 18, 2024 · 0 comments · May be fixed by #6995
Labels
Area: Fusion Issue is related to Hot Chocolate Fusion 🐛 bug Something isn't working 🌶️ hot chocolate

Comments

@rowe-stamy
Copy link

Product

Hot Chocolate

Version

14.0.0-p66

Link to minimal reproduction

https://github.com/rowe-stamy/FusionBug

Steps to reproduce

Launch all three projects (ServiceA, ServiceB and Gateway) and run the problematic query against the gateway:

query problem {
  foos {
    commonField
    barByCommonField {
      barField
    }
    fizzByCommonField {
      fizzField
    }
  }
}

What is expected?

The expected outcome should be data as follows:

{
  "data": {
    "foos": [
      {
        "commonField": "commonFieldValue",
        "barByCommonField": {
          "barField": "barFieldValue"
        }
        "fizzByCommonField": {
          "fizzField": "barFieldValue"
        }
      }
    ]
  }
}

What is actually happening?

I am getting a "Unexpected Execution Error"
with the following message:
"An item with the same key has already been added. Key: Foo_commonField"

Relevant log output

at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior) 
at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value) 
at HotChocolate.Fusion.Planning.Pipeline.FieldRequirementsPlannerMiddleware.ResolveVariablesInContext(QueryPlanContext context, FieldContext fieldContext, SelectionExecutionStep executionStep, ObjectFieldInfo fieldInfo, ISelectionSet selectionSet, ResolverDefinition resolver) 
at HotChocolate.Fusion.Planning.Pipeline.FieldRequirementsPlannerMiddleware.ResolveRequirementsForSelectionResolvers(QueryPlanContext context, FieldContext fieldContext, SelectionExecutionStep currentStep, ISelection parentSelection) 
at HotChocolate.Fusion.Planning.Pipeline.FieldRequirementsPlannerMiddleware.Invoke(QueryPlanContext context, QueryPlanDelegate next) 
at HotChocolate.Fusion.Planning.QueryPlanPipelineBuilder.<>c__DisplayClass5_1`1.<Use>b__1(QueryPlanContext context)
at HotChocolate.Fusion.Planning.Pipeline.ExecutionStepDiscoveryMiddleware.Invoke(QueryPlanContext context, QueryPlanDelegate next) 
at HotChocolate.Fusion.Planning.QueryPlanPipelineBuilder.<>c__DisplayClass5_1`1.<Use>b__1(QueryPlanContext context) 
at HotChocolate.Fusion.Planning.QueryPlanner.Plan(IOperation operation) 
at HotChocolate.Fusion.Execution.Pipeline.OperationQueryPlanCompiler.OptimizeOperation(OperationOptimizerContext context) 
at HotChocolate.Execution.Processing.OperationCompiler.CreateOperation(String operationId, OperationDefinitionNode operationDefinition, ObjectType operationType, DocumentNode document, ISchema schema) 
at HotChocolate.Execution.Processing.OperationCompiler.Compile(String operationId, OperationDefinitionNode operationDefinition, ObjectType operationType, DocumentNode document, ISchema schema, IReadOnlyList`1 optimizers, Boolean enableNullBubbling) 
at HotChocolate.Execution.Pipeline.OperationResolverMiddleware.CompileOperation(IRequestContext context, String operationId, OperationDefinitionNode operationDefinition, ObjectType operationType) 
at HotChocolate.Execution.Pipeline.OperationResolverMiddleware.InvokeAsync(IRequestContext context) 
at HotChocolate.Execution.Pipeline.OperationComplexityMiddleware.InvokeAsync(IRequestContext context) 
at HotChocolate.Execution.Pipeline.OperationCacheMiddleware.InvokeAsync(IRequestContext context) 
at HotChocolate.Execution.Pipeline.DocumentValidationMiddleware.InvokeAsync(IRequestContext context) 
at HotChocolate.Execution.Pipeline.DocumentParserMiddleware.InvokeAsync(IRequestContext context) 
at HotChocolate.Execution.Pipeline.DocumentCacheMiddleware.InvokeAsync(IRequestContext context) 
at HotChocolate.Execution.Pipeline.TimeoutMiddleware.InvokeAsync(IRequestContext context) 
at HotChocolate.Execution.Pipeline.ExceptionMiddleware.InvokeAsync(IRequestContext context)"

Additional context

No response

@rowe-stamy rowe-stamy added the 🐛 bug Something isn't working label Mar 18, 2024
@michaelstaib michaelstaib added 🌶️ hot chocolate Area: Fusion Issue is related to Hot Chocolate Fusion labels Mar 20, 2024
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 🐛 bug Something isn't working 🌶️ hot chocolate
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants