aws-amplify / amplify-js

A declarative JavaScript library for application development using cloud services.
https://docs.amplify.aws/lib/q/platform/js
Apache License 2.0
9.44k stars 2.13k forks source link

DataStore not syncing when upgrade from aws-amplify 4.2.6 to 4.3.13 #9534

Closed sacrampton closed 2 years ago

sacrampton commented 2 years ago

Before opening, please confirm:

JavaScript Framework

React Native

Amplify APIs

DataStore

Amplify Categories

api

Environment information

``` # Put output below this line System: OS: macOS 11.5.2 CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz Memory: 214.66 MB / 16.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 16.13.2 - /usr/local/bin/node Yarn: 1.22.17 - /usr/local/bin/yarn npm: 8.1.2 - /usr/local/bin/npm Watchman: 2022.01.10.00 - /usr/local/bin/watchman Browsers: Chrome: 97.0.4692.99 Safari: 14.1.2 npmPackages: @apollo/client: ^3.5.8 => 3.5.8 @apollo/client/cache: undefined () @apollo/client/core: undefined () @apollo/client/errors: undefined () @apollo/client/link/batch: undefined () @apollo/client/link/batch-http: undefined () @apollo/client/link/context: undefined () @apollo/client/link/core: undefined () @apollo/client/link/error: undefined () @apollo/client/link/http: undefined () @apollo/client/link/persisted-queries: undefined () @apollo/client/link/retry: undefined () @apollo/client/link/schema: undefined () @apollo/client/link/utils: undefined () @apollo/client/link/ws: undefined () @apollo/client/react: undefined () @apollo/client/react/components: undefined () @apollo/client/react/context: undefined () @apollo/client/react/hoc: undefined () @apollo/client/react/hooks: undefined () @apollo/client/react/parser: undefined () @apollo/client/react/ssr: undefined () @apollo/client/testing: undefined () @apollo/client/testing/core: undefined () @apollo/client/utilities: undefined () @apollo/client/utilities/globals: undefined () @aws-amplify/datastore-storage-adapter: ^1.2.5 => 1.2.5 @babel/core: ^7.14.0 => 7.16.12 @babel/runtime: ^7.14.0 => 7.16.7 @react-native-async-storage/async-storage: ^1.15.17 => 1.15.17 @react-native-community/cameraroll: ^4.1.2 => 4.1.2 @react-native-community/eslint-config: ^2.0.0 => 2.0.0 @react-native-community/geolocation: ^2.0.2 => 2.0.2 @react-native-community/masked-view: ^0.1.10 => 0.1.11 @react-native-community/netinfo: ^7.1.9 => 7.1.9 @react-native-community/toolbar-android: 0.2.1 => 0.2.1 @react-native-firebase/app: ^8.4.7 => 8.4.7 @react-native-firebase/crashlytics: 8.4.12 => 8.4.12 @react-native-picker/picker: ^2.2.1 => 2.2.1 (1.16.8) @react-navigation/bottom-tabs: ^5.11.3 => 5.11.15 @react-navigation/drawer: ^5.11.5 => 5.12.9 @react-navigation/native: ^5.7.3 => 5.9.8 @react-navigation/stack: ^5.9.0 => 5.14.9 HelloWorld: 0.0.1 LocationEnable: 0.0.1 RNBackgroundExample: 0.0.1 ReactNativeBlobUtilWin: 0.0.1 SimpleEnable: 0.0.1 amazon-cognito-identity-js: ^5.2.5 => 5.2.5 aws-amplify: ^4.3.13 => 4.3.13 aws-amplify-react-native: ^5.0.5 => 5.0.5 aws-appsync: ^4.1.4 => 4.1.4 aws-appsync-react: ^4.0.10 => 4.0.10 babel-jest: ^26.6.3 => 26.6.3 base64-arraybuffer: ^0.2.0 => 0.2.0 eslint: ^7.25.0 => 7.32.0 graphql-tag: ^2.12.6 => 2.12.6 hermes-inspector-msggen: 1.0.0 jest: ^26.6.3 => 26.6.3 lodash: ^4.17.20 => 4.17.21 metro-react-native-babel-preset: ^0.66.0 => 0.66.2 moment-timezone: ^0.5.27 => 0.5.34 native-base: ^2.15.2 => 2.15.2 react: 17.0.2 => 17.0.2 react-apollo: ^3.1.5 => 3.1.5 react-native: 0.65.0 => 0.65.0 react-native-android-location-enabler: ^1.2.1 => 1.2.2 react-native-audio: ^4.3.0 => 4.3.0 react-native-audio-recorder-player: ^3.2.1 => 3.3.4 react-native-aws3: ^0.0.9 => 0.0.9 react-native-background-fetch: ^4.0.3 => 4.0.4 react-native-background-upload: 6.5.0 => 6.5.0 react-native-blob-util: ^0.13.17 => 0.13.18 react-native-camera: ^4.2.1 => 4.2.1 react-native-codegen: ^0.0.11 => 0.0.11 react-native-coverflow: ^0.1.7 => 0.1.7 react-native-device-info: ^5.6.1 => 5.6.5 react-native-document-picker: ^3.2.4 => 3.5.4 react-native-fs: ^2.18.0 => 2.18.0 react-native-gesture-handler: ^1.7.0 => 1.10.3 react-native-get-random-values: ^1.7.0 => 1.7.2 react-native-image-picker: ^3.5.0 => 3.8.1 react-native-image-placeholder: ^1.0.14 => 1.0.14 react-native-image-resizer: ^1.4.4 => 1.4.5 react-native-keep-awake: ^4.0.0 => 4.0.0 react-native-linear-gradient: ^2.5.6 => 2.5.6 react-native-loading-spinner-overlay: ^1.0.1 => 1.1.0 react-native-localize: ^2.0.3 => 2.1.9 react-native-maps: ^0.28.0 => 0.28.1 react-native-modal: ^11.10.0 => 11.10.0 react-native-picker-select: ^6.5.0 => 6.6.0 react-native-progress-circle: ^2.1.0 => 2.1.0 react-native-reanimated: ^1.13.2 => 1.13.3 react-native-restart: ^0.0.22 => 0.0.22 react-native-safe-area-context: ^3.1.9 => 3.3.2 react-native-safe-area-view: ^1.1.1 => 1.1.1 react-native-screens: ^2.16.1 => 2.18.1 react-native-simple-dialogs: ^1.4.0 => 1.4.0 react-native-sqlite-storage: ^6.0.1 => 6.0.1 react-native-uuid-generator: ^6.1.1 => 6.1.1 react-native-vector-icons: ^8.0.0 => 8.1.0 (7.1.0) react-native-version-number: ^0.3.6 => 0.3.6 react-native-webview: ^11.2.0 => 11.17.1 react-redux: ^7.2.2 => 7.2.6 react-test-renderer: 16.13.1 => 16.13.1 recompose: ^0.30.0 => 0.30.0 redux: ^4.0.5 => 4.1.2 (3.7.2) redux-logger: ^3.0.6 => 3.0.6 redux-persist: ^6.0.0 => 6.0.0 (4.10.2) redux-persist/constants: undefined () redux-persist/integration/react: undefined () redux-persist/storages: undefined () seamless-immutable: ^7.1.4 => 7.1.4 uuid: ^8.3.2 => 8.3.2 (3.4.0, 3.3.2) npmGlobalPackages: corepack: 0.10.0 npm: 8.1.2 ```

Describe the bug

We are trying to upgrade to aws-amplify and dependent libraries to the latest version.

Our app is working fine on aws-amplify@4.2.6 - but when we upgrade to the latest aws-amplify@4.3.13 many of our models are failing to sync with the mobile.

Similar issues seem to be mentioned in these issues:

Environment related information: 1- Project is created using cli. 2- "react": "17.0.2" 3- "react-native": "0.65.0" 4- "aws-amplify": "^4.3.13" 5- "@aws-amplify/datastore-storage-adapter": "^1.2.5"

Expected behavior

Sync completed on 4.3.13 as it does on 4.2.6

Reproduction steps

Upgrade then attempt to sync

Code Snippet

// Put your code below this line.

Log output

``` // Put your logs below this line ```

aws-exports.js

No response

Manual configuration

No response

Additional configuration

No response

Mobile Device

No response

Mobile Operating System

No response

Mobile Browser

No response

Mobile Browser Version

No response

Additional information and screenshots

No response

chrisbonifacio commented 2 years ago

Hi @sacrampton 👋 thank you for raising this issue. Can you share what, if any, errors you might be seeing from the Amplify logger? Do you notice any particular differences between the models having issues and the ones that seem to sync properly?

iartemiev commented 2 years ago

Piggybacking off of what Chris said above -

If something is preventing the DataStore Sync Engine from starting correctly, the library will log out errors or warnings with additional information that will help us diagnose the problem.

Please enable debug-level logging in your app via:

import { Logger } from 'aws-amplify';
Logger.LOG_LEVEL = 'DEBUG';

and then share any relevant logs with us here.

sacrampton commented 2 years ago

Hi @iartemiev / @chrisbonifacio

It would appear that the latest version (4.3.13) is always using a page size of 1,000 regardless of what syncPageSize is set to.

In the attached screen shots we identified an error from the logger showing it was ResolverExecutionLimitReached which we solved previously by setting syncPageSize = 500.

So with this same setting in v4.2.6 we can see it is passing this limit of 500 - but with the same setting in v4.3.13 it is defaulting to 1,000 and ignoring syncPageSize setting of 500.

On_4 3 13 On_4 2 6 dataStoreSyncSize dataStoreError
iartemiev commented 2 years ago

That was very helpful. Thanks for sharing that info! I just opened a PR that fixes this: https://github.com/aws-amplify/amplify-js/pull/9542

I will report back once the fix has been merged and released.

iartemiev commented 2 years ago

@sacrampton the fix will be released tomorrow. I'll comment here as soon as the new version is out.

iartemiev commented 2 years ago

@sacrampton we've released the fix as part of version 4.3.14 of Amplify. Please let us know if that resolves this issue for you.

sacrampton commented 2 years ago

Thanks @iartemiev - can confirm that 4.3.14 fixes the issue in our app in both iOS and Android.

github-actions[bot] commented 1 year ago

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels or Discussions for those types of questions.