Joystream / Joystream/hydra

Can't sort the query result set by a valid worker_DESC property defined in the schema

Open
#481 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

med-prio qn-hydra-board to-triage
Dominant language
TypeScript
Stars
50
Forks
43
PR merge metrics
No merged PRs in 30d

Description

Steps to reproduce

Console: https://graphql-console.subsquid.io/?graphql_api=https://query.joystream.org/graphql

Execute query

query Payouts {
  rewardPaidEvents(orderBy: worker_DESC) {
    id
  }
}

Actual Result:

{
  "errors": [
    {
      "message": "column rewardpaidevent.undefined does not exist",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "rewardPaidEvents"
      ],
      "extensions": {
        "code": "INTERNAL_SERVER_ERROR",
        "exception": {
          "message": "column rewardpaidevent.undefined does not exist",
          "length": 124,
          "name": "QueryFailedError",
          "severity": "ERROR",
          "code": "42703",
          "position": "152",
          "file": "parse_relation.c",
          "line": "3349",
          "routine": "errorMissingColumn",
          "query": "SELECT \"rewardpaidevent\".\"id\" AS \"rewardpaidevent_id\" FROM \"reward_paid_event\" \"rewardpaidevent\" WHERE \"rewardpaidevent\".\"deleted_at\" IS NULL ORDER BY \"rewardpaidevent\".\"undefined\" DESC LIMIT 50",
          "parameters": []
        }
      }
    }
  ],
  "data": null
}

Expected result

The query is valid, so I expect some data in response.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the rewardPaidEvents query in the linked GraphQL console and trace the orderBy handling for worker_DESC. Inspect the generated SQL shown in the error, especially why the field becomes undefined. Done means the valid query returns data without an invalid-column error.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, postgresql, typescript
Domain
api, backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.