aws-amplify / amplify-flutter

A declarative library with an easy-to-use interface for building Flutter applications on AWS.
https://docs.amplify.aws
Apache License 2.0
1.31k stars 243 forks source link

Error during subscription., cause=ApiAuthException{message=Tried to use owner/group-based authorization on an API that is not configured with either Cognito User Pools or OpenID Connect #1636

Closed sadaqatdev closed 2 years ago

sadaqatdev commented 2 years ago

Description

after adding new model to data store we faced this issue , in iOS data is syncing perfectly. only we have face this issue in android

W/amplify:aws-datastore(27849): DataStoreException{message=Error during subscription., cause=ApiAuthException{message=Tried to use owner/group-based authorization on an API that is not configured with either Cognito User Pools or OpenID Connect., cause=null, recoverySuggestion=Verify that the API is configured with either Cognito User Pools or OpenID Connect. @auth with owner/group-based authorization is not supported for other modes.}, recoverySuggestion=Evaluate details.}

Graphql schema

type RoomConnectServiceStatus @model @auth(rules: [{allow: owner, operations: [read, create, update, delete]}, {allow: private, operations: [read, create, update, delete], provider: iam}, {allow: public, operations: [read, create, update, delete], provider: iam}]) { id: ID! isActivated: Boolean roomId: String serviceID: String currentDeviceUid: String updateTime: AWSTimestamp }

type MqttCloudConfig @model @auth(rules: [{allow: owner, operations: [read, create, update, delete]}, {allow: private, operations: [read], provider: iam}, {allow: public, operations: [read], provider: iam}]) { id: ID! ip: String port: String password: String username: String }

type Nurse @model @auth(rules: [{allow: owner, operations: [read, create, update, delete]}, {allow: private, operations: [read, create, update, delete], provider: iam}, {allow: public, operations: [read, create, update, delete], provider: iam}]) { id: ID! name: String phone: AWSPhone! thumbnail: String }

type Owner @model @auth(rules: [{allow: owner, operations: [read, create, update, delete]}, {allow: private, operations: [read, create, update, delete], provider: iam}, {allow: public, operations: [read, create, update, delete], provider: iam}]) { id: ID! roomID: ID nurseID: ID }

type Room @model @auth(rules: [{allow: owner, operations: [read, create, update, delete]}, {allow: private, operations: [read, create, update, delete], provider: iam}, {allow: public, operations: [read, create, update, delete], provider: iam}]) { id: ID! title: String }

type RoomConnecttoService @model @auth(rules: [{allow: owner, operations: [read, create, update, delete]}, {allow: private, operations: [read, create, update, delete], provider: iam}, {allow: public, operations: [read, create, update, delete], provider: iam}]) { id: ID! roomID: ID serviceID: ID currentDeviceUid: String isActivated: Boolean }

type Services @model @auth(rules: [{allow: owner, operations: [read, create, update, delete]}, {allow: private, operations: [read, create, update, delete], provider: iam}, {allow: public, operations: [read, create, update, delete], provider: iam}]) { id: ID! name: String ordered: Boolean fulfilled: Boolean thumbnail: String roomConnectoId: String }

type Patient @model @auth(rules: [{allow: owner, operations: [read, create, update, delete]}, {allow: private, operations: [read, create, update, delete], provider: iam}, {allow: public, operations: [read, create, update, delete], provider: iam}]) { id: ID! name: String phone: AWSPhone! thumbnail: String }

type SubscribedRooms @model @auth(rules: [{allow: owner, operations: [read, create, update, delete]}, {allow: private, operations: [read, create, update, delete], provider: iam}, {allow: public, operations: [read, create, update, delete], provider: iam}]) { id: ID! roomID: ID userID: ID }

Categories

Steps to Reproduce

add new data model to data store and run pub update command

Screenshots

No response

Platforms

Android Device/Emulator API Level

API 29, API 30, API 31

Environment

[✓] Flutter (Channel stable, 2.10.4, on macOS 12.1 21C52 darwin-arm, locale en-PK)
[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
[✓] Xcode - develop for iOS and macOS (Xcode 13.3)
[✓] Chrome - develop for the web
[✓] Android Studio
[✓] VS Code (version 1.67.2)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

Dependencies

Dart SDK 2.16.2
Flutter SDK 2.10.4
sister_help 1.0.0+1

dependencies:
- amplify_api 0.4.5 [amplify_api_plugin_interface amplify_core collection flutter meta plugin_platform_interface]
- amplify_auth_cognito 0.4.5 [flutter amplify_auth_plugin_interface amplify_core amplify_auth_cognito_android amplify_auth_cognito_ios collection plugin_platform_interface]
- amplify_datastore 0.4.5 [flutter amplify_datastore_plugin_interface amplify_core plugin_platform_interface meta collection async]
- amplify_flutter 0.4.5 [amplify_analytics_plugin_interface amplify_api_plugin_interface amplify_auth_plugin_interface amplify_core amplify_datastore_plugin_interface amplify_storage_plugin_interface collection flutter json_annotation meta plugin_platform_interface]
- connectivity_plus 2.3.0 [flutter connectivity_plus_platform_interface connectivity_plus_linux connectivity_plus_macos connectivity_plus_web connectivity_plus_windows]
- cupertino_icons 1.0.4
- cupertino_tabbar 2.0.0 [flutter]
- flutter 0.0.0 [characters collection material_color_utilities meta typed_data vector_math sky_engine]
- flutter_dialogs 2.1.1 [flutter]
- flutter_image_compress 1.1.0 [flutter]
- flutter_launcher_icons 0.9.2 [args image path yaml]
- flutter_localizations 0.0.0 [flutter intl characters clock collection material_color_utilities meta path typed_data vector_math]
- hive 2.1.0 [meta crypto]
- hive_flutter 1.1.0 [flutter hive path_provider path]
- image_picker 0.8.5 [flutter image_picker_android image_picker_for_web image_picker_ios image_picker_platform_interface]
- intl 0.17.0 [clock path]
- mqtt_client 9.6.7 [typed_data event_bus path crypto meta]
- package_info_plus 1.4.2 [flutter package_info_plus_platform_interface package_info_plus_linux package_info_plus_macos package_info_plus_windows package_info_plus_web]
- pdf 3.6.4 [archive barcode crypto image meta path_parsing vector_math xml]
- permission_handler 9.2.0 [flutter meta permission_handler_android permission_handler_apple permission_handler_windows permission_handler_platform_interface]
- pin_code_fields 7.4.0 [flutter]
- provider 5.0.0 [collection flutter nested]
- qr_code_scanner 0.6.1 [js flutter flutter_web_plugins]
- qr_flutter 4.0.0 [flutter qr]
- share_plus 4.0.4 [meta mime flutter share_plus_platform_interface share_plus_linux share_plus_macos share_plus_windows share_plus_web]

transitive dependencies:
- amplify_analytics_plugin_interface 0.4.5 [amplify_core flutter meta]
- amplify_api_plugin_interface 0.4.5 [amplify_core collection flutter json_annotation meta]
- amplify_auth_cognito_android 0.4.5 [flutter]
- amplify_auth_cognito_ios 0.4.5 [amplify_core flutter]
- amplify_auth_plugin_interface 0.4.5 [flutter meta amplify_core]
- amplify_core 0.4.5 [flutter plugin_platform_interface collection date_time_format meta uuid]
- amplify_datastore_plugin_interface 0.4.5 [flutter meta collection amplify_core]
- amplify_storage_plugin_interface 0.4.5 [flutter meta amplify_core]
- archive 3.3.0 [crypto path]
- args 2.3.0
- async 2.8.2 [collection meta]
- barcode 2.1.0 [meta qr]
- characters 1.2.0
- charcode 1.3.1
- clock 1.1.0
- collection 1.15.0
- connectivity_plus_linux 1.3.0 [flutter connectivity_plus_platform_interface meta nm]
- connectivity_plus_macos 1.2.2 [connectivity_plus_platform_interface flutter]
- connectivity_plus_platform_interface 1.2.0 [flutter meta plugin_platform_interface]
- connectivity_plus_web 1.2.0 [connectivity_plus_platform_interface flutter_web_plugins flutter]
- connectivity_plus_windows 1.2.0 [connectivity_plus_platform_interface flutter]
- cross_file 0.3.2 [flutter js meta]
- crypto 3.0.1 [collection typed_data]
- date_time_format 2.0.1
- dbus 0.7.3 [args ffi meta xml]
- event_bus 2.0.0
- ffi 1.1.2
- file 6.1.2 [meta path]
- flutter_plugin_android_lifecycle 2.0.5 [flutter]
- flutter_web_plugins 0.0.0 [flutter js characters collection material_color_utilities meta typed_data vector_math]
- http 0.13.4 [async http_parser meta path]
- http_parser 4.0.0 [charcode collection source_span string_scanner typed_data]
- image 3.1.3 [archive meta xml]
- image_picker_android 0.8.4+11 [flutter flutter_plugin_android_lifecycle image_picker_platform_interface]
- image_picker_for_web 2.1.6 [flutter flutter_web_plugins image_picker_platform_interface]
- image_picker_ios 0.8.5 [flutter image_picker_platform_interface]
- image_picker_platform_interface 2.4.4 [cross_file flutter http plugin_platform_interface]
- js 0.6.3
- json_annotation 4.5.0 [meta]
- material_color_utilities 0.1.3
- meta 1.7.0
- mime 1.0.1
- nested 1.0.0 [flutter]
- nm 0.5.0 [dbus]
- package_info_plus_linux 1.0.5 [package_info_plus_platform_interface flutter path]
- package_info_plus_macos 1.3.0 [flutter]
- package_info_plus_platform_interface 1.0.2 [flutter meta plugin_platform_interface]
- package_info_plus_web 1.0.5 [flutter flutter_web_plugins http meta package_info_plus_platform_interface]
- package_info_plus_windows 1.0.5 [package_info_plus_platform_interface ffi flutter win32]
- path 1.8.0
- path_parsing 0.2.1 [vector_math meta]
- path_provider 2.0.9 [flutter path_provider_android path_provider_ios path_provider_linux path_provider_macos path_provider_platform_interface path_provider_windows]
- path_provider_android 2.0.13 [flutter path_provider_platform_interface]
- path_provider_ios 2.0.8 [flutter path_provider_platform_interface]
- path_provider_linux 2.1.5 [ffi flutter path path_provider_platform_interface xdg_directories]
- path_provider_macos 2.0.5 [flutter path_provider_platform_interface]
- path_provider_platform_interface 2.0.3 [flutter platform plugin_platform_interface]
- path_provider_windows 2.0.5 [ffi flutter path path_provider_platform_interface win32]
- permission_handler_android 9.0.2+1 [flutter permission_handler_platform_interface]
- permission_handler_apple 9.0.4 [flutter permission_handler_platform_interface]
- permission_handler_platform_interface 3.7.0 [flutter meta plugin_platform_interface]
- permission_handler_windows 0.1.0 [flutter permission_handler_platform_interface]
- petitparser 4.4.0 [meta]
- platform 3.1.0
- plugin_platform_interface 2.1.2 [meta]
- process 4.2.4 [file path platform]
- qr 2.1.0 [meta]
- share_plus_linux 3.0.0 [share_plus_platform_interface file flutter meta url_launcher]
- share_plus_macos 3.0.0 [share_plus_platform_interface flutter]
- share_plus_platform_interface 3.0.2 [flutter meta mime plugin_platform_interface]
- share_plus_web 3.0.0 [share_plus_platform_interface url_launcher flutter flutter_web_plugins meta]
- share_plus_windows 3.0.0 [share_plus_platform_interface flutter meta url_launcher]
- sky_engine 0.0.99
- source_span 1.8.1 [collection path term_glyph]
- string_scanner 1.1.0 [charcode source_span]
- term_glyph 1.2.0
- typed_data 1.3.0 [collection]
- url_launcher 6.1.0 [flutter url_launcher_android url_launcher_ios url_launcher_linux url_launcher_macos url_launcher_platform_interface url_launcher_web url_launcher_windows]
- url_launcher_android 6.0.16 [flutter url_launcher_platform_interface]
- url_launcher_ios 6.0.15 [flutter url_launcher_platform_interface]
- url_launcher_linux 3.0.0 [flutter url_launcher_platform_interface]
- url_launcher_macos 3.0.0 [flutter url_launcher_platform_interface]
- url_launcher_platform_interface 2.0.5 [flutter plugin_platform_interface]
- url_launcher_web 2.0.9 [flutter flutter_web_plugins url_launcher_platform_interface]
- url_launcher_windows 3.0.0 [flutter url_launcher_platform_interface]
- uuid 3.0.6 [crypto]
- vector_math 2.1.1
- win32 2.5.2 [ffi]
- xdg_directories 0.2.0+1 [meta path process]
- xml 5.3.1 [collection meta petitparser]
- yaml 3.1.0 [collection source_span string_scanner]

Device

N/A

OS

N/A

CLI Version

8.0.2

Additional Context

after adding new model to data store we faced this issue

HuiSF commented 2 years ago

Hi @sadaqatdev thanks for opening this issue. The exception is very self explanatory.

after adding new model to data store we faced this issue

sadaqatdev commented 2 years ago

but working fine in iOS, only error in android and I have done amplify pull and Flutter clean , still error exits

HuiSF commented 2 years ago

Can you paste the content of amplifyconfiguration.dart (please mask out sensitive data fields). Also the code snippet initiating API and DataStore plugin.

Looking at the amplify-android implementation, it throws this exception due to the API request object doesn't have a valid authType defined. May need more Information to reproduce this issue.

Jordan-Nelson commented 2 years ago

@sadaqatdev - If you are still experiencing this issue can you please provide the info request above? Thanks.

Jordan-Nelson commented 2 years ago

@sadaqatdev - I am going to close out this issue since we have not heard back. If you are still experiencing this issue, please open a new issue with the info requested above. Thanks.