#GraphQL query sometimes returning null/faulty data on relation fields

4 messages · Page 1 of 1 (latest)

blazing chasm
#

I have a simple query. But on each refetch sometimes car fields are null or contact fields, or both. I have no clue why, some help debugging would be great.

query Dashboard($today: DateTime! = "2024-02-20T01:53:31Z") {
  CarsStatistics {
    count {
      total
      noStatus
      financing
      leasing
      purchaseOption
      rentToOwn
    }
  }
  FinanceStatistics {
    revenue {
      total
      cost
      profit
    }
  }

  # TODO: pagination
  Reminders(
    draft: false
    sort: "date"
    where: { done: { equals: false } }
    limit: 9999
  ) {
    docs {
      id
      title
      date
      done
      car {
        id
        manufacturer
        model
        licensePlate
      }
      contact {
        relationTo
        value {
          __typename
          ... on Person {
            id
            firstName
            lastName
          }
          ... on Company {
            id
            name
          }
        }
      }
    }
  }

  Contracts(
    limit: 15
    sort: "endDate"
    where: {
      AND: [
        { _status: { equals: published } }
        { endDate: { greater_than_equal: $today } }
        { startDate: { less_than_equal: $today } }
      ]
    }
  ) {
    docs {
      id
      car {
        id
        manufacturer
        model
        licensePlate
      }

      customer {
        relationTo
        value {
          __typename
          ... on Person {
            id
            firstName
            lastName
          }
          ... on Company {
            id
            name
          }
        }
      }

      startDate
      endDate
    }
  }
}
empty breachBOT
slate shard
blazing chasm
#

Ended up switching CMS, saved me some headache.