在访问自定义query输出时出现“Not Authorized to access on type”错误

0

【以下的问题经过翻译处理】 我创建了几个自定义的query,如下所示,并将它们的输出设置为非@model类型。

type someOutput {
  a : Int
  b: String
}

type Mutation {
  someMutation(
    input: someInput!
  ): someOutput 
    @function(name: "lambdafunction-${env}")
    @auth(rules: [{
      allow: private
    }])
}

当我在AppSync中测试时,会出现“Not Authorized to access on type”的错误。

我尝试通过将globalAuthRule设置为public来解决它。但是可以通过授予所有字段的字段级别授权来解决。

有没有办法在不使用字段级别授权的情况下授予非@model类型的许可?还是我应该以其他方式编写模式?

我非常困惑,因为我在其他项目中使用了同样的模式并且使用得很好。

profile picture
专家
已提问 5 个月前84 查看次数
1 回答
0

【以下的回答经过翻译处理】 在这里提供解决方案。

type someOutput @aws_cognito_user_pools {
  a : Int
  b: String
}

profile picture
专家
已回答 5 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则