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

After changing the schema, deserializeException occurs in iOS. #415

Closed
Arosf opened this issue Mar 1, 2021 · 7 comments
Closed

After changing the schema, deserializeException occurs in iOS. #415

Arosf opened this issue Mar 1, 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 iOS Issues specific to the iOS Platform pending-release Issues that have been addressed in main but have not been released

Comments

@Arosf
Copy link

Arosf commented Mar 1, 2021

Describe the bug
I added a name to User as follows, generated code, did an amplify push, and built the iOS app, but an exception occurred.
The android app did not throw any exceptions.

type User @model {
  id: ID!
  name: String <-- new
}

An exception was thrown when the following code was executed.

final user = await datastore.query(
  Amp.User.classType,
  where: Amp.User.ID.eq(userId),
);

The error message displayed is as follows.

DataStoreException (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.)))

Stack trace when an exception is thrown.

#0      AmplifyDataStoreMethodChannel.query
package:amplify_datastore/method_channel_datastore.dart:73
<asynchronous suspension>
#1      AmplifyDataStore.query
package:amplify_datastore/amplify_datastore.dart:71
#2      DataStoreCategory.query
package:amplify_flutter/categories/amplify_datastore_category.dart:52
#3      UserRepository.fetch
package:flutter_template/…/user/user_repository.dart:14
<asynchronous suspension>
#4      _UserPageState._checkAndRegistUser
package:flutter_template/main.dart:262
#5      _UserPageState.initState

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

Smartphone (please complete the following information):

  • Device: [e.g. iPhone12 Pro Max (ios simulator)]
  • OS: [e.g. iOS14.4]
  • Version [flutter 1.22.6]
@haverchuck
Copy link
Member

@Arosf Which version of amplify_datastore are you using?

@haverchuck haverchuck added clarification-needed datastore Issues related to the DataStore Category labels Mar 1, 2021
@fjnoyp
Copy link
Contributor

fjnoyp commented Mar 1, 2021

Thanks @Arosf we are able to reproduce this issue on our side and are looking into it.

@Arosf
Copy link
Author

Arosf commented Mar 2, 2021

@haverchuck amplify_datastore version is 0.1.0

@fjnoyp
Copy link
Contributor

fjnoyp commented Mar 2, 2021

Hi @Arosf 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.

@fjnoyp fjnoyp added bug Something is not working; the issue has reproducible steps and has been reproduced 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. and removed clarification-needed labels Mar 2, 2021
@Arosf
Copy link
Author

Arosf commented Mar 2, 2021

@fjnoyp Thank you to the corresponding!

@fjnoyp
Copy link
Contributor

fjnoyp commented Mar 11, 2021

Hi @Arosf after looking through our code more, we have a fix in place for this issue that you reported.

PR fix:
#439

I'll reopen this issue and mark it as pending this PR.

@fjnoyp fjnoyp added pending-release Issues that have been addressed in main but have not been released and removed requires-ios-fix This issue is the result of an underlying Amplify iOS issue that needs to be fixed. labels Mar 11, 2021
@fjnoyp fjnoyp self-assigned this Mar 11, 2021
@haverchuck haverchuck removed the pending-release Issues that have been addressed in main but have not been released label Jun 24, 2021
@HuiSF HuiSF added the pending-release Issues that have been addressed in main but have not been released label Aug 28, 2021
@HuiSF
Copy link
Member

HuiSF commented Sep 9, 2021

The fix for this issue has been released with version 0.2.3. When schema changes, DataStore will automatically clear local DB and recreate tables with the latest schema and resync data from cloud.

@HuiSF HuiSF closed this as completed Sep 9, 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
bug Something is not working; the issue has reproducible steps and has been reproduced datastore Issues related to the DataStore Category iOS Issues specific to the iOS Platform pending-release Issues that have been addressed in main but have not been released
Projects
None yet
Development

No branches or pull requests

4 participants