Get type mismatch when using array of dynamic groups in @auth rules
See original GitHub issueI am trying to use an array of dynamic groups in the @auth rules and I get type mismatch error. It works in the mock just fine though. It also works if I use a single group instead of an array. Here are my schema and the error message that I am getting.
type ViralLoad
@model
@key(
name: "ByDate"
fields: ["groups", "createdAt"]
queryField: "viralLoadByGroup"
)
@auth(
rules: [
{ allow: owner }
{ allow: groups, groupsField: "groups", operations: [read] }
]
) {
id: ID!
location: String!
createdAt: AWSDateTime
time: [ViralLoadTime]
reagentKitID: String
machineID: String
samples: [ViralSample]
groups: [String]
}
type ViralLoadTime {
start: AWSDateTime
stop: AWSDateTime
experimental: AWSDateTime
}
type ViralSample {
load: Int
control: Int
}
My sample mutation.
mutation MyMutation {
createViralLoad(input: {location: "Location 1", createdAt: "2020-09-09T00:00:00Z", groups: ["Admin"]}) {
location
createdAt
}
}
And the error message.
{
"data": {
"createViralLoad": null
},
"errors": [
{
"path": [
"createViralLoad"
],
"data": null,
"errorType": "DynamoDB:DynamoDbException",
"errorInfo": null,
"locations": [
{
"line": 2,
"column": 3,
"sourceName": null
}
],
"message": "One or more parameter values were invalid: Type mismatch for Index Key groups Expected: S Actual: L IndexName: ByDate (Service: DynamoDb, Status Code: 400, Request ID: QRGBTDVJ7EDIJV0JBK4JCJCDHRVV4KQNSO5AEMVJF66Q9ASUAAJG, Extended Request ID: null)"
}
]
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
Top Results From Across the Web
Type mismatch on an Array assignment in ASP - Stack Overflow
Alternately If I setup questions as a dynamic array then the assignment fails with a type mismatch error. Class Survey public ID public...
Read more >LLVM Language Reference Manual
Abstract¶. This document is a reference manual for the LLVM assembly language. LLVM is a Static Single Assignment (SSA) based representation that provides ......
Read more >Firebase Cloud Messaging HTTP protocol - Google
Emulator Suite Security Rules Unit Testing Library. Overview · HostAndPort · RulesTestContext · RulesTestEnvironment · TestEnvironmentConfig. iOS — Swift.
Read more >NSX API Guide 6.4 - VMware Docs
Configuring REST Clients for the NSX REST API. Some common REST clients include Postman, RESTClient (a Firefox add-on), and curl (a command-line tool)....
Read more >SQL Error Messages | InterSystems IRIS Data Platform 2022.2
-19, An aggregate function cannot be used in a WHERE or GROUP BY clause. -20, Name conflict in the FROM ... -193, Model...
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
The problem is even earlier. There is a bug in the @key transformer code that validates the schema. It incorrectly tests for scalar types. It calls a method to get the field type, but that method looks inside lists and reports on the type of the list, so it never detects an invalid list type. See here
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.