“放大推动力”在 AWS Appsync 中创建新的类型变量 - React Native

发布于 2025-01-10 04:00:54 字数 528 浏览 2 评论 0原文

当我执行放大推送时,我会在 Appsync 架构中获得一些变量。

这是来自 React Native amplify/backend 文件夹中的 schema.graphql 。

type Botdata @model (subscriptions: null){
  client_id: String!
  id: String!
  lock_status: Float
}

这就是我在放大推送之后在 Appsync 架构上得到的结果,

type Botdata {
   client_id: String!
   id: String!
   lock_status: Float
   createdAt: AWSDateTime!
   updatedAt: AWSDateTime!
   _version: Int!
   _deleted: Boolean
   _lastChangedAt: AWSTimestamp!
}

这会导致整个操作出现未定义的类型错误。请帮我。谢谢!

When I do amplify push, I get a few variables in the Appsync Schema.

This is from schema.graphql in react native amplify/backend folder.

type Botdata @model (subscriptions: null){
  client_id: String!
  id: String!
  lock_status: Float
}

And this is what I get on the Appsync Schema after amplify push

type Botdata {
   client_id: String!
   id: String!
   lock_status: Float
   createdAt: AWSDateTime!
   updatedAt: AWSDateTime!
   _version: Int!
   _deleted: Boolean
   _lastChangedAt: AWSTimestamp!
}

This causes my undefined type error for the entire operation. Please help me. Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

清欢 2025-01-17 04:00:54

也许您开启了乐观并发。当应用程序和数据库之间存在冲突数据版本时,这很有用,但您需要:

  • 在使用突变时检查_version,如果应用程序上的_version与数据库上行数据的_version字段不同,则操作突变会返回错误。

如果您不需要乐观并发,您可以关闭它:

  • 转到文件夹项目,使用管理员打开命令行。
  • 运行:amplify update api
  • 选择:graphql
  • 选择:禁用冲突检测
  • 将 api 更新到云:amplify Push
    希望我的回答对您有帮助。

Maybe you was turn on Optimistic Concurrency. This helpful when you have conflict data version between app and database but you need:

  • Check _version when you use mutation if _version on app different _version field of row data on Database then operation mutation you return error.

If you don't need Optimistic Concurrency you can turn of that:

  • go to folder project open command line with administrator.
  • run: amplify update api
  • choose: graphql
  • choose: Disable conflict detection
  • update api to cloud: amplify push
    Hope my answer helpful for you.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文