小编por*_*las的帖子

AWS Amplify 未经授权错误 - 未授权访问类型 [...]

我有一个使用 google federate 登录的 AWS Amplify 应用程序。这是我的数据模型。

type TriadeMetric @model @auth(rules: [{allow: owner}]) {
  id: ID!
  NoteMetrics: [NoteMetric] @hasMany(indexName: "byTriadeMetric", fields: ["id"])
}

enum MetricEnum {
  ACCURACY
  DURATION
}

type NoteMetric @model @auth(rules: [{allow: owner}]) {
  id: ID!
  metricType: MetricEnum
  value: Float
  triademetricID: ID! @index(name: "byTriadeMetric")
  semitones: Int
}
Run Code Online (Sandbox Code Playgroud)

当我尝试使用创建新记录时

const triadeMetric = await DataStore.save(new TriadeMetric({}));
Run Code Online (Sandbox Code Playgroud)

我收到此警告消息:

[{"errorType":"Unauthorized","message":"Not Authorized to access onCreateTriade on type Triade"}]}

和这个错误:

{"errors":[{"errorType":"Unauthorized to access onCreateTriade on type Triade"}]}

aws-amplify

7
推荐指数
1
解决办法
7296
查看次数

标签 统计

aws-amplify ×1