graphql-platform icon indicating copy to clipboard operation
graphql-platform copied to clipboard

"Could not resolve the actual object type" error when `null` returned in list of interfaces

Open gao-artur opened this issue 4 years ago • 10 comments

Schema

type Query{
  test: [BaseType]
}
interface BaseType {
  name: ID!
}
type ConcreteType implements BaseType {
  name: ID!
}

Query

query {
  test {
    __typename
  }
}

Response

{
  "errors": [
    {
      "message": "Could not resolve the actual object type from `HotChocolate.Language.NullValueNode` for the abstract type `test`.",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "test",
        0
      ]
    }
  ],
  "data": {
    "test": [
      null
    ]
  }
}

Expected behavior null should be returned in list without errors.

Additional context HC v11.2.2

gao-artur avatar Apr 26 '21 10:04 gao-artur

Slack conversation https://hotchocolategraphql.slack.com/archives/CD9TNKT8T/p1619428143159200

gao-artur avatar Apr 26 '21 10:04 gao-artur

Hi @gao-artur
I tried to reproduce the issue you described in #3626 but could not reporduce it in a test cann you provide a repro of this issue?

PascalSenn avatar Apr 29 '21 22:04 PascalSenn

Hi @PascalSenn Was able to reproduce it only when using stitching. Please see repo here https://github.com/gao-artur/graphql-stitching-3594

gao-artur avatar Apr 30 '21 10:04 gao-artur

Hi @PascalSenn I just tried to debug this issue and that's what I found:

When the remote schema executor reaches this line the result is null: image

But when stitching schema executor reaches same line the result is NullValueNode: image

Would this be the correct fix for the bug?

if (result is null || result is NullValueNode)
{
    completedResult = null;
    return true;
}

gao-artur avatar May 30 '21 14:05 gao-artur

this is fixed with 4064

michaelstaib avatar Sep 16 '21 13:09 michaelstaib

@michaelstaib what version should I use to verify the fix? I just tried 12.0.0-rc.11 but the issue still reproduced.

gao-artur avatar Sep 20 '21 12:09 gao-artur

@michaelstaib please reopen the bug, it still reproducible with 12.0.1.

gao-artur avatar Oct 12 '21 09:10 gao-artur

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.

stale[bot] avatar May 04 '22 13:05 stale[bot]

Still reproduced with stable 12.8.2 and latest 13.0.0-preview.19.

gao-artur avatar May 06 '22 14:05 gao-artur

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.

stale[bot] avatar Sep 03 '22 14:09 stale[bot]

HotChocolate.Stitching is now in legacy mode and is replaced by HotChocolate.Fusion. I am closing this issue as we essentially froze the fusion code.

You can join the preview of Hot Chocolate Fusion now on Slack

michaelstaib avatar Mar 08 '23 20:03 michaelstaib