在访问自定义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달 전91회 조회
1개 답변
0

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

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

profile picture
전문가
답변함 5달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠