2

我有这个查询:

getMyTransactions {
  id
  createdAt
}

我得到了这个错误:

  "message": "Cannot return null for non-nullable field Transaction.createdAt.",
  "path": [
    "_entities",
    0,
    "createdAt"
  ],
  "extensions": {
    "code": "INTERNAL_SERVER_ERROR",
    "serviceName": "XXX",
    "query": "query($representations:[_Any!]!){_entities(representations:$representations){...on Transaction{createdAt}}}",
    "variables": {
      "representations": [
        {
          "__typename": "Transaction",
          "id": "29bf75e5-b79e-4a7d-a021-84a8b5662aa8"
        },
        {
          "__typename": "Transaction",
          "id": "616f3f8a-3c81-4d2e-bce0-03d031a15062"
        }
      ]
    },
//etc

为什么variables.representations缺少createdAt值?当我直接对 DynamoDB 进行查询时,我可以看到createdAt所有这两项的值。

我的模式是这样的:

extend type Transaction @key(fields: "id") {
  id: ID! @external
}

type Query {
  getMyTransactions: [Transaction!]!
}

另一个模式具有事务类型:

type Transaction @key(fields: "id") {
  id: ID!
  createdAt: String!
}
4

0 回答 0