graphql-relay-php icon indicating copy to clipboard operation
graphql-relay-php copied to clipboard

Type does not resolve

Open factormaarten opened this issue 3 years ago • 0 comments

Hi there,

I've implemented this library and have troube resolving Types. Here's a gist of my code: https://gist.github.com/factormaarten/511353c716f0aade231f7160a3eef455

What I'm noticing is that up until this query it goes well:

query trades {
  trades(first:3) {
    edges {
      node
    }
  }
}

Then I simply get:

{
  "errors": [
    {
      "message": "Field \"node\" of type \"Trade\" must have a sub selection.",
      "extensions": {
        "category": "graphql"
      },
      "locations": [
        {
          "line": 4,
          "column": 7
        }
      ]
    }
  ]
}

But when I then add a subselection it fails:

query trades {
  trades(first:3) {
    edges {
      node {
        id
      }
    }
  }
}

or

query trades {
  trades(first:3) {
   	pageInfo {
      hasNextPage
    }
  }
}

Both result in:

{
  "errors": [
    {
      "message": "Internal server error",
      "extensions": {
        "category": "internal"
      },
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "trades"
      ]
    }
  ],
  "data": {
    "trades": null
  }
}

I would asume results aren't returned properly, but https://gist.github.com/factormaarten/511353c716f0aade231f7160a3eef455#file-querytype-php-L37 does give back results.

It looks like the resolveField in TradeType.php does not get called.

What am I doing wrong?

factormaarten avatar Dec 02 '21 19:12 factormaarten