-
Notifications
You must be signed in to change notification settings - Fork 824
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
Get type mismatch when using array of dynamic groups in @auth rules #5300
Comments
The "byDate" GSI uses groups as part of the key. Keys can only be string, number, or binary types. They cannot be lists. |
So the problem is in the key section not actually using an array for the auth. I wonder why this is working in the amplify mock. |
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 |
Thanks Ross, this was driving me crazy. At least I know what I have to do to get it working. |
resolves aws-amplify#5300 Logic for 'isScalar' treated lists as scalar types. This allowed indexes to be created with invalid key types. This modifies the isScalar function to return false for list types, and updates other areas as needed with a new 'isScalarOrScalarList' function Includes new test which fails without this fix. Fixes adjacent tests failing because of missing model transforms, and not for the stated reason.
resolves aws-amplify#5300 Logic for 'isScalar' treated lists as scalar types. This allowed indexes to be created with invalid key types. This modifies the isScalar function to return false for list types, and updates other areas as needed with a new 'isScalarOrScalarList' function Includes new test which fails without this fix. Fixes adjacent tests failing because of missing model transforms, and not for the stated reason.
resolves aws-amplify#5300 Logic for 'isScalar' treated lists as scalar types. This allowed indexes to be created with invalid key types. This modifies the isScalar function to return false for list types, and updates other areas as needed with a new 'isScalarOrScalarList' function Includes new test which fails without this fix. Fixes adjacent tests failing because of missing model transforms, and not for the stated reason.
* fix(graphql-key-transformer): prevent non-scalar key fields resolves #5300 Logic for 'isScalar' treated lists as scalar types. This allowed indexes to be created with invalid key types. This modifies the isScalar function to return false for list types, and updates other areas as needed with a new 'isScalarOrScalarList' function Includes new test which fails without this fix. Fixes adjacent tests failing because of missing model transforms, and not for the stated reason. * fix: schema generation for list input types
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 |
I 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.
My sample mutation.
And the error message.
The text was updated successfully, but these errors were encountered: