[Bug] upmost __typename in mutation finds no resolver

Report a Dgraph Bug

Error Message: “__typename was not executed because no suitable resolver could be found - this indicates a resolver or validation bug. Please let us know by filing an issue.”

this error message occurs if one tries to include __typename under mutation.

What version of Dgraph are you using?

v20.11.0

Have you tried reproducing the issue with the latest release?

I think this is the latest release

What is the hardware spec (RAM, OS)?

RAM: 15GB
OS: Ubuntu 20.04.1 LTS

Steps to reproduce the issue (command/config used to run Dgraph).

mutation:

mutation addTest($input: [AddTestInput!]!) {
  __typename   <- this one
  addTest(input: $input) {
    __typename
    test {
      __typename
      name
    }
  }
}

query variables:

{
	"input": [
		{
			"name": "john"
		}
	]
}

schema type:

type Test {
    name: String!
}

result:

{
  "errors": [
    {
      "message": "__typename was not executed because no suitable resolver could be found - this indicates a resolver or validation bug. Please let us know by filing an issue."
    },
    {
      "message": "Mutation addTest was not executed because of a previous error.",
      "locations": [
        {
          "line": 3,
          "column": 3
        }
      ]
    }
  ],
.
.
.

Expected behaviour and actual result.

result:

{
  "data": {
    "__typename": "Mutation",
    "addTest": {
      "__typename": "AddTestPayload",
      "test": [
        {
          "__typename": "Test",
          "name": "john"
        }
      ]
    }
  },
.
.
.

Hi @noobloser, this behavior is not allowed. You can’t query __typename or anything on type mutation.

Hello @JatinDevDG,
thank your for your response.
If you know I’d like to know if that is a deliberate design decision or just so happens to be,
as I can get the __typename of a query just fine.

1 Like

The reason this is such a huge problem at the moment, is the
main flutter library for graphql by default puts the __typename also under mutations.
This seems to be an issue purely with dgraph, as other have not mentioned such an issue.

Because I quite like working with the library and dgraph as both are awesome implementations imo, I’d like to resolve this issue to limit the entry barrier for new users that do not want to deviate from the default path of the library.

Github issue I refer to: GraphQL-Flutter #784

Yeah, i guess it’s better to change that in library. We will also see if it’s required behaviour and then discuss internally.

Hi @noobloser, we discussed it and found that it’s a bug. We will create a ticket for this and fix it soon. Thanks.

1 Like

This is awesome news. Thanks to you and the team.
I’d apprechiate it if you post here, when the solution is implemented, so I can close the librarys github issue accordingly.
Till then, thanks again.

1 Like

@JatinDevDG @noobloser I faced the same issue as well. Had filed an issue in GraphQL Mesh here: Mesh SDK execution fails · Issue #1339 · Urigo/graphql-mesh · GitHub where we narrowed it all down to this issue.

My mutation from Mesh looked like this:

mutation ($graphqlTools0_updatedAuthMethod: UpdateAuthMethodInput!) {
  graphqlTools0___typename: __typename
  graphqlTools0___typename: __typename
  graphqlTools0___typename: __typename
  graphqlTools0___gqtld0__: __typename
  graphqlTools0___typename: __typename
  graphqlTools0___gqtld1__: updateAuthMethod(
    input: $graphqlTools0_updatedAuthMethod
  ) {
    __typename
    __typename
    __typename
    authMethod {
      __typename
      __typename
      __typename
      id
      __typename
      __typename
      __typename
      authKey
      __typename
      __typename
      __typename
      verificationStatus
      __typename
      __typename
      __typename
      authProviderMethod {
        __typename
        __typename
        __typename
        id
      }
      __typename
      __typename
      __typename
      metadata
      __typename
      __typename
      __typename
      account {
        __typename
        __typename
        __typename
        id
      }
      __typename
      __typename
      __typename
      creationTime
    }
  }
}

and returned the same error:

Hi @noobloser @tvvignesh, fix for this issue is merged in the master branch.
PR: fix(GraphQL): This PR allow to use __typename in mutation. by JatinDevDG · Pull Request #7285 · dgraph-io/dgraph · GitHub

3 Likes