-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GraphQL Error for hasMany relation where some records are denied read access, but others are not #9236
Comments
Initial investigation and details present in this discord thread: https://discord.com/channels/967097582721572934/1307023111056785418 It seems to maybe be an inconsistent issue, but that min repro seems to consistently have the issue. |
The issue seems to be here. The field is supposed to be an array of non-null values, but it inserts false-y values into the array ( A simple solutution is to modify L480 to I can implement this change, create some tests, and submit a PR if this solution sounds good to the maintainers. |
This issue has been marked as stale due to lack of activity. To keep this issue open, please indicate that it is still relevant in a comment below. |
This issue was automatically closed due to lack of activity. |
Describe the Bug
When using access control to restrict access to a collection, the GraphQL api will give errors and not return the correct data if some but not all records are denied readability in a
relation
field with many related records.If all are read-allowed, it works fine. If all are denied, it's also fine. But if some are allowed and some are not, it returns null for the entire field.
Link to the code that reproduces this issue
https://github.com/6TELOIV/graphql-null-relations
Reproduction Steps
Run the server on your local machine with a local PostgreSQL DB
On the
DemoGlobal
, add multiple relatedDemo
items, checkingvisible
on some but not others.Visit
localhost:3000/api/graphql-playground
in a private window/logged out contextInput the following query:
Observe the error:
Error: Cannot return null for non-nullable field DemoGlobal.demoRelationship.
Which area(s) are affected? (Select all that apply)
area: core, db-postgres
Environment Info
The text was updated successfully, but these errors were encountered: