Skip to content
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

More granular query access in Auth rule leads to "invalid string supplied: LIST" #3434

Open
2 of 14 tasks
ruossn opened this issue Jul 18, 2023 · 3 comments
Open
2 of 14 tasks
Assignees
Labels
datastore Issues related to the DataStore Category feature-parity A request for a feature that is fully or partially available on another platform (JS, iOS, Android) feature-request A request for a new feature or an enhancement to an existing API or category. requires-ios-fix This issue is the result of an underlying Amplify iOS issue that needs to be fixed.

Comments

@ruossn
Copy link

ruossn commented Jul 18, 2023

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.(FlutterAuthRule.kt:20)
E/DartMessenger(30599): at com.amazonaws.amplify.amplify_datastore.types.model.FlutterModelSchema.(FlutterModelSchema.kt:16)
E/DartMessenger(30599): at com.amazonaws.amplify.amplify_datastore.AmplifyDataStorePlugin.registerSchemas(AmplifyDataStorePlugin.kt:728)
E/DartMessenger(30599): at com.amazonaws.amplify.amplify_datastore.AmplifyDataStorePlugin.onConfigureDataStore(AmplifyDataStorePlugin.kt:222)
E/DartMessenger(30599): at com.amazonaws.amplify.amplify_datastore.AmplifyDataStorePlugin.onMethodCall(AmplifyDataStorePlugin.kt:194)
E/DartMessenger(30599): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:258)
E/DartMessenger(30599): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
E/DartMessenger(30599): at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:322)
E/DartMessenger(30599): at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/DartMessenger(30599): at android.os.Handler.handleCallback(Handler.java:942)
E/DartMessenger(30599): at android.os.Handler.dispatchMessage(Handler.java:99)
E/DartMessenger(30599): at android.os.Looper.loopOnce(Looper.java:201)
E/DartMessenger(30599): at android.os.Looper.loop(Looper.java:288)
E/DartMessenger(30599): at android.app.ActivityThread.main(ActivityThread.java:7898)
E/DartMessenger(30599): at java.lang.reflect.Method.invoke(Native Method)
E/DartMessenger(30599): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
E/DartMessenger(30599): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
I/flutter (30599): Amplify plugin was not added

Categories

  • Analytics
  • API (REST)
  • API (GraphQL)
  • Auth
  • Authenticator
  • DataStore
  • Notifications (Push)
  • Storage

Steps to Reproduce

No response

Screenshots

No response

Platforms

  • iOS
  • 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
...
}

...
@Equartey Equartey added datastore Issues related to the DataStore Category pending-triage This issue is in the backlog of issues to triage labels Jul 18, 2023
@HuiSF
Copy link
Member

HuiSF commented Jul 18, 2023

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.

aws-amplify/amplify-android#2265
aws-amplify/amplify-swift#2720

We need to get them merged first then can test support using granular control in Amplify Flutter DataStore.

@Equartey Equartey added pending-release Issues that have been addressed in main but have not been released and removed pending-triage This issue is in the backlog of issues to triage labels Jul 18, 2023
@ruossn
Copy link
Author

ruossn commented Jul 19, 2023

Thanks for your fast response. Maybe that should be documented or is it documented and i was just not able to find it?

@Equartey Equartey added pending-triage This issue is in the backlog of issues to triage and removed pending-release Issues that have been addressed in main but have not been released labels Jul 20, 2023
@cwomack cwomack added Investigating and removed pending-triage This issue is in the backlog of issues to triage labels Jul 20, 2023
@Equartey Equartey self-assigned this Jul 20, 2023
@Equartey Equartey added requires-ios-fix This issue is the result of an underlying Amplify iOS issue that needs to be fixed. and removed Investigating labels Jan 17, 2024
@Equartey Equartey added the bug Something is not working; the issue has reproducible steps and has been reproduced label Jan 25, 2024
@Jordan-Nelson
Copy link
Member

@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

@Jordan-Nelson Jordan-Nelson added feature-request A request for a new feature or an enhancement to an existing API or category. feature-parity A request for a feature that is fully or partially available on another platform (JS, iOS, Android) and removed bug Something is not working; the issue has reproducible steps and has been reproduced labels May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
datastore Issues related to the DataStore Category feature-parity A request for a feature that is fully or partially available on another platform (JS, iOS, Android) feature-request A request for a new feature or an enhancement to an existing API or category. requires-ios-fix This issue is the result of an underlying Amplify iOS issue that needs to be fixed.
Projects
None yet
Development

No branches or pull requests

5 participants