xataio / client-ts

Xata.io SDK for TypeScript and JavaScript
https://xata.io/docs/sdk/typescript/overview
Apache License 2.0
123 stars 8 forks source link

Request the `id` from a link crash #561

Closed fabien0102 closed 2 years ago

fabien0102 commented 2 years ago

Describe the bug Requesting the id attribute from a link make the request failed.

Reproduction steps

const { records: ascents } = await xata.db.ascents
      .filter({ "route.id": id })
      .select([
        "id",
        "attemptsCount",
        "createdAt",
        "climber.id", // This line make the app crash
        "climber.name",
        "climber.pictureUrl",
      ])
      .getPaginated();
FetcherError: columns invalid: table [climbers]: column [id]: column not found
    at fetch$1 (C:\Users\fabie\Projects\talk-berlin-ts-17-08-2022\server\node_modules\@xata.io\client\src\api\fetcher.ts:64:11)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at RestRepository.query (C:\Users\fabie\Projects\talk-berlin-ts-17-08-2022\server\node_modules\@xata.io\client\src\schema\repository.ts:213:40)      
    at C:\Users\fabie\Projects\talk-berlin-ts-17-08-2022\server\src\routes.ts:59:34 {
  status: 400,
  errors: undefined,
  requestId: 'e52bb848-0025-436f-bc50-807f8a54291c',
  cause: undefined
}

Expected behavior Not crashing 😅

Software version

"@xata.io/client": "0.16.1"

Additional context Please note that the climber.id was already part of the result, this was more to have the id explicitely requested.

SferaDev commented 2 years ago

Not an SDK problem. Fix in review: https://github.com/xataio/xata/pull/1024