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

Getting 'Error: Invalid argument' when querying data with predicate containing enum. #722

Closed
EmmanuelOgbewe opened this issue Jul 15, 2021 · 7 comments
Assignees
Labels
bug Something is not working; the issue has reproducible steps and has been reproduced datastore Issues related to the DataStore Category

Comments

@EmmanuelOgbewe
Copy link

EmmanuelOgbewe commented Jul 15, 2021

Describe the bug
I have a schema that contains an enum. When querying this data and providing an enum as a predicate I receive an error saying Invalid argument.

Expected behavior
The enum provided as a predicate matches the enum type used in the schema. I do not expect to get the error.

Screenshots
ActivityNotification model contains enum NotificationType.

Screen Shot 2021-07-15 at 1 21 35 AM

Querying for recipient notifications matching the type NotificationType.FriendRequest
Screen Shot 2021-07-15 at 1 20 42 AM

Error received is Invalid argument: Instance of 'NotificationType'

Platform
Amplify Flutter current supports iOS and Android. This issue is reproducible in (check all that apply):
[] Android
[X] iOS

Output of flutter doctor -v
  darwin-x64, locale en-US)
  • Flutter version 2.0.6 at /Users/emmanuelogbewe/flutter
  • Framework revision 1d9032c7e1 (3 months ago), 2021-04-29
    17:37:58 -0700
  • Engine revision 05e680e202
  • Dart version 2.12.3

[✓] Android toolchain - develop for Android devices (Android
  SDK version 29.0.3)
  • Android SDK at /Users/emmanuelogbewe/Library/Android/sdk
  • Platform android-29, build-tools 29.0.3
  • Java binary at: /Applications/Android
    Studio.app/Contents/jre/jdk/Contents/Home/bin/java
  • Java version OpenJDK Runtime Environment (build
    1.8.0_202-release-1483-b49-5587405)
  • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
  • Xcode at /Applications/Xcode.app/Contents/Developer
  • Xcode 12.0.1, Build version 12A7300
  • CocoaPods version 1.10.0

[✓] Chrome - develop for the web
  • Chrome at /Applications/Google
    Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 3.5)
  • Android Studio at /Applications/Android
    Studio.app/Contents
  • Flutter plugin version 44.0.1
  • Dart plugin version 191.8593
  • Java version OpenJDK Runtime Environment (build
    1.8.0_202-release-1483-b49-5587405)

[✓] VS Code (version 1.57.1)
  • VS Code at /Applications/Visual Studio Code.app/Contents
  • Flutter extension version 3.24.0

[✓] Connected device (2 available)
  • iPhone 11 (mobile) • 2A493D3E-54BB-43AA-94CE-B0148EC28830
    • ios            •
    com.apple.CoreSimulator.SimRuntime.iOS-14-0 (simulator)
  • Chrome (web)       • chrome
    • web-javascript • Google Chrome 91.0.4472.114

• No issues found!```

</details>

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6] Simulator IPhone 11
- OS: [e.g. iOS8.1] 13
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
@HuiSF
Copy link
Member

HuiSF commented Jul 15, 2021

From the error message, it looks like the data is being sent from native side to flutter side contains data format other than json.

Which platform did you produce this error on please? @EmmanuelOgbewe

@HuiSF HuiSF added the datastore Issues related to the DataStore Category label Jul 15, 2021
@EmmanuelOgbewe
Copy link
Author

Error produced on IOS. @HuiSF

@HuiSF
Copy link
Member

HuiSF commented Jul 16, 2021

Thanks @EmmanuelOgbewe ! This issue is reproducible on my end, I will investigate and get back to you.

@HuiSF
Copy link
Member

HuiSF commented Jul 16, 2021

This issue is caused by the method serializedDynamicValue in query_field_operators not having a appropriate handling of serializing enum type values. I will look into it and try to find a solution to address this issue.

@HuiSF HuiSF self-assigned this Jul 16, 2021
@EmmanuelOgbewe
Copy link
Author

Thank you! @HuiSF

@HuiSF HuiSF added the pending-release Issues that have been addressed in main but have not been released label Jul 19, 2021
@HuiSF
Copy link
Member

HuiSF commented Jul 28, 2021

Hi @EmmanuelOgbewe the fix for this issue has been release along with version 0.2.1. Please update the library to get the fix, and feel free to follow up if you encounter any issues. Thanks!

@HuiSF HuiSF closed this as completed Jul 28, 2021
@HuiSF HuiSF removed the pending-release Issues that have been addressed in main but have not been released label Jul 28, 2021
@EmmanuelOgbewe
Copy link
Author

EmmanuelOgbewe commented Jul 29, 2021

@HuiSF Thank you!! Most definitely will.

@HuiSF HuiSF added the bug Something is not working; the issue has reproducible steps and has been reproduced label Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working; the issue has reproducible steps and has been reproduced datastore Issues related to the DataStore Category
Projects
None yet
Development

No branches or pull requests

2 participants