Skip to content

Some articles are having null createdAt #34

@MrOrz

Description

@MrOrz

Null values will cause errors in ListArticle query. For example, the last cursor returned by this query is broken by null:

{
 ListArticles(orderBy:{createdAt:DESC}, filter:{replyCount:{GT:0}}, first:50, after:"WzE0ODE4ODk2MDAwMDAsIjUzNTg1NDY2MDEwMTUtcnVtb3IiXQ==") {
      pageInfo {
        firstCursor
        lastCursor
      }
      edges {
        cursor
        node {
          id
        }
      }
    }
}

When the broken cursor is used, it will cause error.

Query:

{
 ListArticles(orderBy:{createdAt:DESC}, filter:{replyCount:{GT:0}}, first:50, after:"Wy05MjIzMzcyMDM2ODU0Nzc2MDAwLCIwNmRiMTAxMTE3ZTFlYjgyYzE4MjI0MTA0YmQwYTgxYS1ydW1vciJd") {
      pageInfo {
        firstCursor
        lastCursor
      }
      edges {
        cursor
        node {
          id
        }
      }
    }
}

Result:

{
  "data": {
    "ListArticles": {
      "pageInfo": {
        "firstCursor": null,
        "lastCursor": null
      },
      "edges": null
    }
  },
  "errors": [
    {
      "message": "[illegal_state_exception] No matching token for number_type [BIG_INTEGER]",
      "locations": [
        {
          "line": 4,
          "column": 9
        }
      ],
      "path": [
        "ListArticles",
        "pageInfo",
        "firstCursor"
      ],
      "authError": false
    },
    {
      "message": "[illegal_state_exception] No matching token for number_type [BIG_INTEGER]",
      "locations": [
        {
          "line": 5,
          "column": 9
        }
      ],
      "path": [
        "ListArticles",
        "pageInfo",
        "lastCursor"
      ],
      "authError": false
    },
    {
      "message": "[illegal_state_exception] No matching token for number_type [BIG_INTEGER]",
      "locations": [
        {
          "line": 7,
          "column": 7
        }
      ],
      "path": [
        "ListArticles",
        "edges"
      ],
      "authError": false
    }
  ]
}

We should either handle null or properly fill in missing values so that elasticsearch don't generate broken cursors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions