Unauthorized error with @connection
See original GitHub issueDescribe the bug I have received a permission error from AppSync on @connection fields.
Amplify CLI Version 4.23.3 (latest)
To Reproduce
Schema example
type Customer
@searchable
@key(fields: ["id"])
@model
@auth(rules: [{ allow: owner, ownerField: "id", operations: [read, create, update] }]) {
id: ID!
name: String
customerParameters: CustomerParameters @connection(fields: ["id"])
createdAt: AWSDateTime
updatedAt: AWSDateTime
}
type CustomerParameters
@key(fields: ["id"])
@model
@auth(rules: [{ allow: owner, ownerField: "id", operations: [read, create, update] }]) {
id: ID!
value: String!
customer: Customer @connection(fields: ["id"])
}
Query
query query {
getCustomer(id:"123") {
id
name
customerParameters {
id
}
}
}
Response
Version 4.23.3 (latest) it’s not working
{
"data": {
"getCustomer": {
"id": "123",
"name": "My Customer",
"customerParameters": null
}
},
"errors": [
{
"path": [
"getCustomer",
"customerParameters"
],
"data": null,
"errorType": "Unauthorized",
"errorInfo": null,
"locations": [
{
"line": 5,
"column": 5,
"sourceName": null
}
],
"message": "Not Authorized to access customerParameters on type Customer"
}
]
}
Expected behavior
Version 4.22.0 it’s working
{
"data": {
"getCustomer": {
"id": "123",
"name": "Customer Name"
"customerParameters": null
}
}
}
Desktop (please complete the following information):
The build is being done at Amplify Console.
Additional context
My model schema is big, so I extracted just one piece of it.
Edit.: Amplify version
Issue Analytics
- State:
- Created 3 years ago
- Reactions:6
- Comments:9 (1 by maintainers)
Top Results From Across the Web
401 Unauthorized - HTTP - MDN Web Docs
The HyperText Transfer Protocol (HTTP) 401 Unauthorized response status code indicates that the client request has not been completed ...
Read more >401 Error: 5 Ways to Troubleshoot and Fix It - Hostinger
The 401 Unauthorized error indicates that the server's request was not verified because it lacks valid authentication credentials for the target ...
Read more >How to Fix a 401 Unauthorized Error - Lifewire
The 401 Unauthorized error is an HTTP status code that means the page you were trying to access cannot be loaded until you...
Read more >How to Quickly Fix the 401 Unauthorized Error (5 Methods)
The 401 (Unauthorized) status code indicates that the request has not been applied because it lacks valid authentication credentials for the ...
Read more >401 Unauthorized Error: What It Is and How to Fix It
The most common cause of a 401 Unauthorized Error is an incorrect URL. As discussed before, web servers will disallow access to improper ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@mogarick The fix is included in cli v4.27.2+
@blbigelow You should change something in the model, because, strangely, the amplify does not apply changes if you don’t change the model. I lost too much time to discover this behaviour.