"Not Authorized to access on type" error when accessing output from Custom Query, Mutation

0

I created several custom mutations and queries as below and set their output to non-@model type.

type someOutput {
  a : Int
  b: String
}

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

When I test this in AppSync, a "Not Authorized to access on type" error occurs.
I couldn't solve it by setting globalAuthRule to public. It can be solved by granting field-level authorization to all fields.
Is there any way to grant permission to non-@model type without using field level authorization? Or should I write the schema some other way?
I am very confused because I have used schema written in the same way in other projects and used it well.

gerrard
已提問 1 年前檢視次數 382 次
1 個回答
0
已接受的答案

Solution here.

type someOutput @aws_cognito_user_pools {
  a : Int
  b: String
}
gerrard
已回答 1 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南