twentyhq / twenty

Building a modern alternative to Salesforce, powered by the community.
https://twenty.com
Other
20.23k stars 2.25k forks source link

GraphQL - Using "orderBy" in conjunction with "after" results in missing column error #8041

Open janwo opened 2 weeks ago

janwo commented 2 weeks ago

Bug Description

When fetching opportunities or custom data models with after in conjunction with orderBy, an error is returned indicating that e.g. opportunity.updatedat column does not exist.

The following error is thrown:

"errors": [
    {
      "message": "column opportunity.updatedat does not exist",
      "extensions": {
        "code": "INTERNAL_SERVER_ERROR",
        "response": "column opportunity.updatedat does not exist"
      }
    }
  ],
  "data": {
    "opportunities": null
  }

The following query was used. Make sure to update the after string.

query FetchOpportunities($filter: OpportunityFilterInput, $first: Int) {
  opportunities(
    first: $first
    orderBy: [{updatedAt: DescNullsFirst}]
    after: "eyJ1cGRhdGVkQXQiOiIyMDI0LTEwLTI0VDEyOjEzOjM3LjYwNloiLCJpZCI6Ijg0ZTZhYTg1LWIzYzUtNDg3YS05ZDRmLTVhMDdlZjBlZmU2YSJ9"
  ) {
    edges {
      node {
        name
      }
    }
    pageInfo {
      endCursor
    }
  }
}

Expected Behavior

The query should return a list of opportunities, sorted by the updatedAt column, without any errors.

Technical Inputs

rob-luke commented 2 weeks ago

I think this same bug causes errors when I sort my notes by last update or created by

image