Skip to content
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

Model connection doesn't respect @auth when model queries are set to null #6561

Closed
adam-nygate opened this issue Feb 6, 2021 · 2 comments
Closed
Labels
bug Something isn't working graphql-transformer-v1 Issue related to GraphQL Transformer v1

Comments

@adam-nygate
Copy link

adam-nygate commented Feb 6, 2021

Describe the bug
If you disable query generation on a type (i.e @model(queries: null)), then GQL queries will fail when you try to query for this model via a connection because the generated Model*Connection fails to have the proper auth directives applied.

Amplify CLI Version
4.41.2

To Reproduce
Example schema:

type Post 
@model(timestamps:null) 
@auth(rules: [{ allow: public}, { allow: private }]) {
    id: ID!
    title: String!
    comments: [Comment] @connection(keyName: "byPost", fields: ["id"]) @auth(rules: [{ allow: public}, { allow: private }])
}

type Comment 
@model(queries: null, mutations: null, subscriptions: null) 
@key(name: "byPost", fields: ["post_id"])
@auth(rules: [{ allow: public}, { allow: private }]) {
    id: ID!
    post_id: ID!
    body: String!
}

run amplify api gql-compile in order to see the generated schema.graphql in ./build/

See that ModelCommentConnection does not have the @aws_api_key @aws_cognito_user_pools (if Cognito User Pools was set up as an alternative auth method)

Expected behavior
I'd like for people to only access Comment via Post.comments, and so disabling Comment queries should allow me to do so without impeding my ability to access Comment via Post.comments.

Desktop (please complete the following information):

  • OS: Mac
  • Node Version: v14.11.0
@SwaySway SwaySway added graphql-transformer-v1 Issue related to GraphQL Transformer v1 pending-triage Issue is pending triage bug Something isn't working and removed pending-triage Issue is pending triage labels Feb 8, 2021
@SwaySway
Copy link
Contributor

SwaySway commented Feb 8, 2021

Closing as PR #5655 fixes this issue. This fix will be included in the next release.

@SwaySway SwaySway closed this as completed Feb 8, 2021
@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working graphql-transformer-v1 Issue related to GraphQL Transformer v1
Projects
None yet
Development

No branches or pull requests

2 participants