Comments (11)
Hi @dadaocao, thank you for submitting this issue. We are going to look into it now and get back to you when we have an update, thanks.
from amplify-flutter.
Hi @MelodyXinyi, Amplify Flutter currently does not support the web platform when using the DataStore category.
If web is a requirement, I would suggest exploring if the GraphQL category can fulfill your data needs. Most of the time we see the offline feature (main difference) of DataStore is not a hard requirement and GraphQL is more than enough to solve your business needs.
from amplify-flutter.
Hi @dadaocao, I was able to confirm this issue and received the "Setting currentState to LOCAL_ONLY" message when running the app on android. We will investigate how to fix this and get back to you with any updates, thank you.
from amplify-flutter.
By the way, our team is planning to add web platform to our current project. Does it mean the Datastore strategy should no longer be suitable for our flutter project?
from amplify-flutter.
If we use GraphQL for web part, does it mean we have to throw away all DataStore configuration for current iOS and Android?
from amplify-flutter.
Hi @MelodyXinyi, unsure what you're referring to as "DataStore configuration".
At its core DataStore is built on top of the API category, Amplify Flutter's DataStore uses Amplify Android & Amplify Swift's API implementation, but even those still use the same backend as Amplify Flutter GraphQL. You will be connecting to the same backend so no data is lost, the only change is the API you will interact with the models.
Is there specific configuration you are concerned about losing?
Also, I'm not sure if you work with the original author of this issue, @dadaocao, if not please open a new issue so we can keep discussion focused.
from amplify-flutter.
Sorry for making you misunderstand, these two accounts both belong to me, so one issue is enough.
Thanks for your reply, I understand what you mean. By the way, is there any update about the origin error? Our Android users are still experiencing long-loading time due to the invalidation of SyncExpression.
from amplify-flutter.
@dadaocao, no worries.
Can you share the sync expression you are seeing the issue with?
from amplify-flutter.
if (!Platform.isAndroid) {
// userId will be set in _fetchAndSetUserId
// then when Amplify.DataStore.start is called in handleSignedIn, it will use userId to sync data
dataStore = AmplifyDataStore(
modelProvider: ModelProvider.instance,
syncExpressions: [
DataStoreSyncExpression(
User.classType, () => User.ID.eq(appData.userId)),
DataStoreSyncExpression(
Journal.classType,
() => Journal.USER
.eq(appData.userId)
.and(Journal.STAMPSTRING.ge(startString)))
]);
}
// Currently, it seems like Android version of DataStore has bug, and we can not use syncExpression on index
from amplify-flutter.
When I ran on Andoird, the following errors will repeat for more than ten times before allowing the user to enter, which cauing long-loading time. Still, there is no problem on iOS.
User
This is sticky GC, maxfree is 8388608 minfree is 524288
I/o.pandoraBioApp(21033): This is non sticky GC, maxfree is 8388608 minfree is 524288
I/o.pandoraBioApp(21033): This is sticky GC, maxfree is 8388608 minfree is 524288
I/o.pandoraBioApp(21033): This is non sticky GC, maxfree is 8388608 minfree is 524288
I/o.pandoraBioApp(21033): This is sticky GC, maxfree is 8388608 minfree is 524288
I/o.pandoraBioApp(21033): This is non sticky GC, maxfree is 8388608 minfree is 524288
I/o.pandoraBioApp(21033): This is sticky GC, maxfree is 8388608 minfree is 524288
I/amplify:aws-datastore(21033): Successfully sync'd down model state from cloud.
I/flutter (21033): DataStore event: modelSynced
I/o.pandoraBioApp(21033): This is non sticky GC, maxfree is 8388608 minfree is 524288
W/amplify:aws-datastore(21033): Sync failed: foreign key constraint violation: ModelWithMetadata{model=SerializedModel{id='56b09280-3c86-4c23-b45a-202d205e9cf2', serializedData={createdAt=2023-09-29T20:37:21.097Z, stampString=2023-09-29T21:00:39.964843000Z, data={"responses":["1994-09-22","0","4","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""]}, kind=personalHistory, stamp=2023-09-29T21:00:39.964843000Z, id=56b09280-3c86-4c23-b45a-202d205e9cf2, user=SerializedModel{id='5f234cef-71de-4fa8-9cf8-c3433d47356f', serializedData={lastName=null, cache=null, _deleted=true, _lastChangedAt=1.709665759678E12, acceptedPrivacyPolicy=true, displayName=test23, joinedAt=2023-09-22, __typename=User, participatingLeaderboard=null, verifiedOver18=true, createdAt=2023-09-22T02:34:04.905Z, firstName=null, participatingProgram=null, cognitoUserId=f057dcb7-39c5-406d-9218-b602bdeb32c0, usernameOfPaymentOption=None123, paymentOption=Zelle, acceptedTermsAndConditions=true, photoImg=assets/images/default_user/user1.png, id=5f234cef-71de-4fa8-9cf8-c3433d47356f, _version=4, email=null, updatedAt=2024-02-23T23:27:40.146Z}, modelName=User}, version=null, updatedAt=2023-09-29T21:00:40.292Z}, modelName=Journal}, syncMetadata=ModelMetadata{id='Journal|56b09280-3c86-4c23-b45a-202d205e9cf2', _deleted=null, _version=13, _lastChangedAt=Temporal.Timestamp{timestamp=1696021240330}}}
W/amplify:aws-datastore(21033): DataStoreException{message=Invalid SQL statement: INSERT INTO `Journal` (`id`, `createdAt`, `data`, `kind`, `stamp`, `stampString`, `updatedAt`, `version`, `userId`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?), cause=android.database.sqlite.SQLiteConstraintException: FOREIGN KEY constraint failed (code 787 SQLITE_CONSTRAINT_FOREIGNKEY), recoverySuggestion=There is a possibility that there is a bug if this error persists. Please take a look at
W/amplify:aws-datastore(21033): https://github.com/aws-amplify/amplify-android/issues to see if there are any existing issues that
W/amplify:aws-datastore(21033): match your scenario, and file an issue with the details of the bug if there isn't.}
W/amplify:aws-datastore(21033): at com.amplifyframework.datastore.storage.sqlite.SQLCommandProcessor.dataStoreException(SQLCommandProcessor.java:87)
W/amplify:aws-datastore(21033): at com.amplifyframework.datastore.storage.sqlite.SQLCommandProcessor.execute(SQLCommandProcessor.java:82)
W/amplify:aws-datastore(21033): at com.amplifyframework.datastore.storage.sqlite.SQLiteStorageAdapter.writeData(SQLiteStorageAdapter.java:769)
W/amplify:aws-datastore(21033): at com.amplifyframework.datastore.storage.sqlite.SQLiteStorageAdapter.lambda$save$3$com-amplifyframework-datastore-storage-sqlite-SQLiteStorageAdapter(SQLiteStorageAdapter.java:366)
W/amplify:aws-datastore(21033): at com.amplifyframework.datastore.storage.sqlite.SQLiteStorageAdapter$$ExternalSyntheticLambda7.run(Unknown Source:12)
W/amplify:aws-datastore(21033): at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:463)
W/amplify:aws-datastore(21033): at java.util.concurrent.FutureTask.run(FutureTask.java:264)
W/amplify:aws-datastore(21033): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
W/amplify:aws-datastore(21033): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
W/amplify:aws-datastore(21033): at java.lang.Thread.run(Thread.java:1012)
W/amplify:aws-datastore(21033): Caused by: android.database.sqlite.SQLiteConstraintException: FOREIGN KEY constraint failed (code 787 SQLITE_CONSTRAINT_FOREIGNKEY)
W/amplify:aws-datastore(21033): at android.database.sqlite.SQLiteConnection.nativeExecute(Native Method)
W/amplify:aws-datastore(21033): at android.database.sqlite.SQLiteConnection.execute(SQLiteConnection.java:730)
W/amplify:aws-datastore(21033): at android.database.sqlite.SQLiteSession.execute(SQLiteSession.java:621)
W/amplify:aws-datastore(21033): at android.database.sqlite.SQLiteStatement.execute(SQLiteStatement.java:47)
W/amplify:aws-datastore(21033): at com.amplifyframework.datastore.storage.sqlite.SQLCommandProcessor.execute(SQLCommandProcessor.java:78)
W/amplify:aws-datastore(21033): ... 8 more
from amplify-flutter.
Thanks, please let me know if you need more info.
from amplify-flutter.
Related Issues (20)
- How to set Public Read while uploading to files to aws. HOT 3
- [amplify_auth_cognito] type 'FetchAuthSessionFetching' is not a subtype of type 'FetchAuthSessionSuccess' in type cast HOT 3
- Feature Request: Sharing authentication state between apps from the same developer HOT 9
- How to call Admin Queries API with authorization? HOT 1
- S3 access denied when making the API call. HOT 2
- No way to send unconfirmed user confirmation email when they restart the app HOT 5
- DataStore sync on Android physical devices takes very long time HOT 7
- Initial DataStore Sync Slow for Android Devices HOT 4
- fetchUserAttributes function cause toomanyrequestexception HOT 8
- AmplifyPushNotificationsPinpoint doesn't support offline configuration HOT 3
- Stuck in WebUI after authenticating with a certificate in iOS HOT 16
- Type comparison with UnderlyingExceptions might not be working as expected. HOT 5
- Update device_info_plus dependency HOT 2
- Update connectivity_plus dependency HOT 1
- Datastore without Cloud sync - Android build failing HOT 6
- Unable to get local issuer certificate when configure Amplify on Windows Devices HOT 8
- User cancelled OAuth flow error from signInWithRedirect
- Amplify confirm sign in with custom authentication flow timing out HOT 1
- Unauthorized error when Data-specific Authorization with AppSync (Datastore/GraphQL) HOT 6
- Flutter Web AmplifyAuthCognito SignOut not working HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amplify-flutter.