Skip to content

Unexpected '__typename not found on object' #509

@AlistairB

Description

@AlistairB

Hi, possibly related to #493

I got around to using the changes for this feature. They are compiling as expected, however now I am getting a runtime error.

My query looks like:

defineByDocumentFile
  "../resource/minimal-github.graphql"
  [gql|
    query FetchRepoFile ($repoOwner: String!, $repoName: String!, $expression: String!) {
      repository(name: $repoName, owner: $repoOwner) {
        object(expression: $expression) {
          ... on Blob {
            isTruncated
            text
          }
        }
      }
    }
  |]

You can see the schema I am using here https://github.com/AlistairB/morpheus-repro/blob/master/minimal-github.graphql .

The error I am getting: Error in $.data.repository.object: key \"__typename\" not found on object

Running this in the github graphql explorer, eg. this query:

query { 
  repository(name: "react", owner: "facebook") {
    object(expression: "af219cc6e6c514099a667ffab4e2d80c5c0c1bcc:.nvmrc") {
      ... on Blob {
        isTruncated
        text
      }
    }
  }
}

produces this response:

{
  "data": {
    "repository": {
      "object": {
        "isTruncated": false,
        "text": "v12.16.2\n"
      }
    }
  }
}

I can include __typename in the query and will get back in the response "__typename": "Blob" (via the github graphql explorer).

Adding __typename to the query that morpheus is using causes compile time errors eg. Error: \"cant find field DataInterface.

Is this enough info? If not I can set up a repro in https://github.com/AlistairB/morpheus-repro

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working📦 clientLabel for affected Package: "morpheus-graphql-client"

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions