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

DataStore query fail on iOS #422

Closed
hyobbb opened this issue Mar 3, 2021 · 8 comments
Closed

DataStore query fail on iOS #422

hyobbb opened this issue Mar 3, 2021 · 8 comments
Assignees
Labels
datastore Issues related to the DataStore Category iOS Issues specific to the iOS Platform requires-ios-fix This issue is the result of an underlying Amplify iOS issue that needs to be fixed.

Comments

@hyobbb
Copy link

hyobbb commented Mar 3, 2021

Describe the bug
Query failed: DataStoreException(message: The operation couldn’t be completed. (SQLite.Result error 0.), recoverySuggestion: The operation couldn’t be completed. (SQLite.Result error 0.), underlyingException: The operation couldn’t be completed. (SQLite.Result error 0.))

query relational model causes error (query comments by postId for example)
on Android it doesn't throw error.

Also, HotRestart on iOS crash app because of AmplifyAlreadyConfiguredException although it should be caught by try&catch.

[VERBOSE-2:ui_dart_state.cc(186)] Unhandled Exception: AmplifyException(message: An unknown exception has happened.           Please take a look at 
        https://github.com/aws-amplify/amplify-flutter/issues to see if there are any existing issues that 
        match your scenario, and file an issue with the details of the bug if there isn't.
  , recoverySuggestion: We currently don't have a recovery suggestion for this exception., underlyingException: PlatformException(AmplifyAlreadyConfigured, Translating platform exception failed. Please take a look at https://github.com/aws-amplify/amplify-flutter/issues to see if there are any existing issues that match your scenario, and file an issue with the details of the bug if there isn't., {recoverySuggestion: Remove the duplicate call to `Amplify.configure()`, underlyingException: nil, message: Amplify has already been configured.}, null))
#0      AmplifyClass.configure (package:amplify_flutter/amplify.dart:187:9)
<asynchronous suspension>
#1      M<…>
@fjnoyp fjnoyp self-assigned this Mar 3, 2021
@fjnoyp fjnoyp added clarification-needed datastore Issues related to the DataStore Category iOS Issues specific to the iOS Platform labels Mar 3, 2021
@fjnoyp
Copy link
Contributor

fjnoyp commented Mar 4, 2021

Hi @hyobbb your issue sounds similar to #415

Have you changed or modified your schema at all?

@hyobbb
Copy link
Author

hyobbb commented Mar 4, 2021

@fjnoyp Hi. Yes I did change schema like below

enum TagStatus {
  ACTIVE
  INACTIVE
}

type Tag @model {
  id: ID!
  text: String!
  rating: Int!
  status: TagStatus!
  # New field with @connection
  videos: [Video] @connection(keyName: "byTag", fields: ["id"])
}

# New model
type Video @model
@key(name: "byTag", fields: ["tagID", "contentUrl"]) {
  id: ID!
  tagID: ID!
  tag: Tag! @connection(fields: ["tagID"])
  contentUrl: String!
  thumbUrl : String!
}

Also, will it support new null safety feature of flutter 2.0 soon?

@fjnoyp
Copy link
Contributor

fjnoyp commented Mar 5, 2021

Thanks for sharing that @hyobbb. It looks like you are getting the same problem as describe in #415

The response I gave there is same for your situation. The issue you encountered comes from the underlying Amplify iOS Library behavior. I have been in communication with their devs and created an issue on their Amplify iOS repo linked here: aws-amplify/amplify-swift#1083.

Once they fix the issue and we update our Amplify iOS Library dependencies, your problem will be resolved. I don't know how long this will take on their side but can provide updates as we investigate/triage it.

We are actively looking into support the new null safety feature of flutter 2.0. We don't have any firm dates for this support but understand its importance for your upgrade to flutter 2.0.

@hyobbb
Copy link
Author

hyobbb commented Mar 5, 2021

@fjnoyp Thanks. I found another issue to report. In my case Video model does not sync even in Android. Tag models sync normally so I can check them in Dynamo DB but Video model only appears in internal sqlite data although it is not in offline mode. Should I open another issue for that?

@fjnoyp fjnoyp added requires-ios-fix This issue is the result of an underlying Amplify iOS issue that needs to be fixed. and removed clarification-needed labels Mar 5, 2021
@fjnoyp
Copy link
Contributor

fjnoyp commented Mar 5, 2021

Yes please report that in a separate issue @hyobbb

When creating that issue, could you specify if you ran amplify push after adding the Video model to your schema? Could you share your logs as well?

@hyobbb
Copy link
Author

hyobbb commented Mar 6, 2021

@fjnoyp Hi.
I cleaned up to local database with Amplify.DataStore.clear() and push it again.
Now it works without any problem. I think it is okay to close this issue as it is the same one with #415
Thank you

@b-cancel
Copy link

This is a bug report I just filed that includes a couple of bugs I found and the workarounds to each
after reading your bug report I think it could help
#822

@HuiSF
Copy link
Member

HuiSF commented Aug 28, 2021

Closing this issue as the issue can be resolved by the workaround, and the root cause is tracked separately.

@HuiSF HuiSF closed this as completed Aug 28, 2021
@davidkim1 davidkim1 mentioned this issue Jun 19, 2022
9 tasks
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 iOS Issues specific to the iOS Platform 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

4 participants