Inconsistent results when listing documents when @auth is applied on the model
See original GitHub issueNote: If your issue/bug is regarding the AWS Amplify Console service, please log it in the Amplify Console GitHub Issue Tracker
Describe the bug I have a user in the cognito user pools with a given number of groups he belongs to. I have a Domain model with an @auth directive to restrict access to the domains based upon the groups a user belongs to. When I call the query listDomains it doesn’t return all domains for the given user, but when I remove the @auth directive on the model it works fine.
Amplify CLI Version 4.18.1
To Reproduce
- Create 15 groups in the cognito user pool
- Create 2 users and give attribute the first users to 10 groups and the 2nd user to 5 groups
- Create the following model:
type Domain
@model
@auth(rules: [
{ allow: groups, groupsField: "group" }
])
{
id: ID!
name: String!
group: String!
}
- Now query with like bellow:
query listMyDomains{
listDomains {
items {
name
group
}
}
}
Expected behavior All domains of the user calling the query are returned
Screenshots
Only a few of the domains the user has access to are returned
Desktop (please complete the following information):
- OS: macOs Catalina 10.15.4
- Node Version. v12.16.1
Additional context
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
This is not a bug. You are likely experiencing a few issues.
My recommendation to resolve this issue is one of the following.
The main principal working with DynamoDB is to not over-fetch data. This means setting up indexes so you can fetch only what you need.
This issue has been automatically locked since there hasn’t been any recent activity after it was closed. Please open a new issue for related bugs.
Looking for a help forum? We recommend joining the Amplify Community Discord server
*-help
channels for those types of questions.