More granular query access in Auth rule leads to "invalid string supplied: LIST"
Description
If we add an read auth rule operation (listen, list, ...) instead of general "read" we get an "java.lang.Exception: stringToModelOperation - invalid string supplied: LIST" Exception while adding the Datastore Plugin. If we replace it with "read" we can add the Datastore plugin.
The complete error in the Terminal:
E/DartMessenger(30599): Uncaught exception in binary message listener
E/DartMessenger(30599): java.lang.Exception: stringToModelOperation - invalid string supplied: LIST
E/DartMessenger(30599): at com.amazonaws.amplify.amplify_datastore.types.model.FlutterAuthRule.stringToModelOperation(FlutterAuthRule.kt:40)
E/DartMessenger(30599): at com.amazonaws.amplify.amplify_datastore.types.model.FlutterAuthRule.
Categories
- [ ] Analytics
- [ ] API (REST)
- [ ] API (GraphQL)
- [ ] Auth
- [ ] Authenticator
- [X] DataStore
- [ ] Notifications (Push)
- [ ] Storage
Steps to Reproduce
No response
Screenshots
No response
Platforms
- [ ] iOS
- [X] Android
- [ ] Web
- [ ] macOS
- [ ] Windows
- [ ] Linux
Flutter Version
3.10.5
Amplify Flutter Version
1.2.0-supports-only-mobile+1
Deployment Method
Amplify CLI
Schema
type Partner
@model(
queries: { get: "getPartner", list: "listPartner" },
subscriptions: null)
@auth(rules: [
{ allow: public, provider: apiKey, operations: [read] },
{ allow: private, provider: iam, operations: [list] }
])
{
publicId: ID! @primaryKey
...
}
...
There is a known gap leveraging granular GraphQL operation controls in both amplify-swift and amplify-android. PRs were open for both libraries to use granular control.
https://github.com/aws-amplify/amplify-android/pull/2265 https://github.com/aws-amplify/amplify-swift/pull/2720
We need to get them merged first then can test support using granular control in Amplify Flutter DataStore.
Thanks for your fast response. Maybe that should be documented or is it documented and i was just not able to find it?
@ruossn - Apologies for the delayed response. I do not believe this is documented as it is not intended behavior and is considered a bug.
For those interested in this, support is pending work in Amplify Swift and we're tracking efforts for that here