Realm GraphQL Query returning error but for no apparent reason

I have a realm graphql query that is returning an error in the React client I have, but when I try it out in the App Services admin UI, it works fine.

{
  "query": {
    "_id": "611e4c5a290dbc5e94ec9bad"
  }
}

query GetProductQuery($query: ProductQueryInput) {
  product(query: $query) {
    __typename
    _id
    associatedProducts {
      __typename
      image
      title
      url
    }
    description
    externalId
    gender
    image
    price
    provider {
      __typename
      logo
      name
    }
    status
    tags
    title
    url
  }
}

and the error is:

reason="could not validate document: \n\tcreatedAt: Invalid type. Expected: type: undefined, bsonType: date, given: [string mixed]\n\texternalId: Invalid type. Expected: type: undefined, bsonType: string, given: [integer int long number mixed]"; code="SchemaValidationFailedRead"; untrusted="read not permitted"; details=map[]

but the document looks like this(I’ve removed some of the irrelevant fields):

{
  "_id": {
    "$oid": "611e4c5a290dbc5e94ec9bad"
  },
  "title": "Bar & Cocoa Chocolate Gift",
  "createdAt": {
    "$date": {
      "$numberLong": "1629375480456"
    }
  },
  "updatedAt": {
    "$date": {
      "$numberLong": "1654656290084"
    }
  },
  "status": "live",
  "externalId": "878138011",
  "metaData": {},
  "provider": {
    "$oid": "610454bf3abf792aeb29b38f"
  },
}

So what the heck is up with that error that seems to be a lie?

I figured it out. It was a problem with the joined/lookedup document “provider”.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.