lecle / aloxide

Aloxide is a pragmatic abstraction layer for various blockchain softwares.
Apache License 2.0
10 stars 5 forks source link

GraphQL connection's after and before doesn't accept cursor #120

Open flowersinthesand opened 4 years ago

flowersinthesand commented 4 years ago

I found this bug in playing around with example-api-gateway.

Poll connection works if after is not given:

{queryPoll(first: 2) {pageInfo{hasNextPage startCursor endCursor} edges {node {id}}}}
{
  "data": {
    "queryPoll": {
      "pageInfo": {
        "hasNextPage": true,
        "startCursor": "YXJyYXljb25uZWN0aW9uOjA=",
        "endCursor": "YXJyYXljb25uZWN0aW9uOjE="
      },
      "edges": [
        {
          "node": {
            "id": 1
          }
        },
        {
          "node": {
            "id": 2
          }
        }
      ]
    }
  }
}

It doesn't work if a correct after which is the value of endCursor is given

{queryPoll(after: "YXJyYXljb25uZWN0aW9uOjE=" first: 2) {pageInfo{hasNextPage startCursor endCursor} edges {node {id}}}}
{
  "data": {
    "queryPoll": null
  },
  "errors": [
    {
      "message": "invalid input syntax for type bigint: \"YXJyYXljb25uZWN0aW9uOjE=\"",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "queryPoll"
      ]
    }
  ]
}

But it does if a wrong after which is the id value of last item of edges' node is given

{queryPoll(after: "2" first: 2) {pageInfo{hasNextPage startCursor endCursor} edges {node {id}}}}
{
  "data": {
    "queryPoll": {
      "pageInfo": {
        "hasNextPage": true,
        "startCursor": "YXJyYXljb25uZWN0aW9uOjA=",
        "endCursor": "YXJyYXljb25uZWN0aW9uOjE="
      },
      "edges": [
        {
          "node": {
            "id": 3
          }
        },
        {
          "node": {
            "id": 4
          }
        }
      ]
    }
  }
}