在访问自定义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
EXPERTE
gefragt vor 5 Monaten91 Aufrufe
1 Antwort
0

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

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

profile picture
EXPERTE
beantwortet vor 5 Monaten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen