The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development. This plugin provides functionality for the API category, allowing for the creation and management of GraphQL and REST based backends for your amplify project.
If applicable, what version of Node.js are you using?
No response
Amplify CLI Version
12.1.1
What operating system are you using?
Pop Os
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
no
Describe the bug
There is weird behavor, where I get Authorization error on API-key authentication if plain type has no @auth rules. If I have just one @auth rule, it seems to somehow work?
As you can see below, is there are no field level @auth rules configured, the query fails with Unauthorized problems.
However if there is at least one @auth rule on the type (AuthTestSingleAuth), somehow it works? Is this intented behavior? Can I safely use only only @auth field rule to reduce the amount of resolvers generated? I want to do this, because I have observed that having less resolvers on the build process on amplify push might allow me to bypass this issue: #1197
Not sure what is expected behavior in this case, but the behavior I'm seeing here seems a little off. Using @auth rules on plain types is not to well covered in the documentation.
Reproduction steps
Use the provided schema
Have API with primary auth set to Cognito
Do the provided example queries
Observe the behavior
Project Identifier
f59e77335650fce92677ec2970143a9b
Log output
```
# Put your logs below this line
```
Additional information
No response
Before submitting, please confirm:
[X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
[X] I have removed any sensitive information from my code snippets and submission.
Hey @parvusville, Thank you for bringing this to our attention and providing the necessary details. We will investigate the issue and keep you informed of our progress.
How did you install the Amplify CLI?
nåm
If applicable, what version of Node.js are you using?
No response
Amplify CLI Version
12.1.1
What operating system are you using?
Pop Os
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
no
Describe the bug
There is weird behavor, where I get Authorization error on API-key authentication if plain type has no @auth rules. If I have just one @auth rule, it seems to somehow work?
Example schema
Lambda
Generated resolvers
These generate the following Resolvers:
Querying the API
With "public" API-key authentication
As you can see below, is there are no field level @auth rules configured, the query fails with Unauthorized problems. However if there is at least one @auth rule on the type (AuthTestSingleAuth), somehow it works? Is this intented behavior? Can I safely use only only @auth field rule to reduce the amount of resolvers generated? I want to do this, because I have observed that having less resolvers on the build process on amplify push might allow me to bypass this issue: #1197
With "private" Cognito user pool authentication
Not quite sure why does this work out of the box? The Default authorization mode of my API is Cognito user pool.
Expected behavior
Not sure what is expected behavior in this case, but the behavior I'm seeing here seems a little off. Using @auth rules on plain types is not to well covered in the documentation.
Reproduction steps
Project Identifier
f59e77335650fce92677ec2970143a9b
Log output
Additional information
No response
Before submitting, please confirm: