首页 > 解决方案 > GraphQL:无法写入增量同步记录

问题描述

我的 Amplify 应用程序上有此架构:

type QnAQuestion @model {
 id: ID!
 questionTitle: String
 questionDescription: String
 questionViews: Int
 askedBy: String
 askedAt: String
 QnaComments: [QnaComment] @connection(keyName: "byQnAQuestion", fields: ["id"])
}

type QnaComment @model @key(name: "byQnAQuestion", fields: ) {
 id: ID!
 comment: String
 commenter: String
 commentedAt: String
 qnaquestionID: ID
}

我想使用此查询添加数据:

mutation MyQuery {
 createQnAQuestion(input: {askedAt: "Test", askedBy: "Test"}) {
   id
 }
}

但是,我得到:

 {
  "data": {
    "createQnAQuestion": null
  },
  "errors": [
    {
      "path": [
        "createQnAQuestion"
      ],
      "data": {
        "id": "xasz"
      },
      "errorType": "DeltaSyncWriteError",
      "errorInfo": null,
      "locations": [
        {
          "line": 2,
          "column": 3,
          "sourceName": null
        }
      ],
      "message": "Failed to write delta sync record."
    }
  ]
}

我的 iOS 应用程序上也存在此错误,虽然.. 记录已创建但返回此错误。

DeltaSyncWriteError

AWS 说:

无法写入增量同步记录。

示例:突变成功,但尝试写入增量同步表时发生内部错误。

标签: amazon-web-servicesgraphqlaws-amplifyaws-appsync

解决方案


推荐阅读