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 Sync Issue: Sometimes, DataStore saves data locally when the network is available. #13832

Closed
3 tasks done
vijaykishan312 opened this issue Sep 19, 2024 · 1 comment
Closed
3 tasks done
Labels
duplicate If marked with duplicate, issue will be closed & original will be added for traceability

Comments

@vijaykishan312
Copy link

Before opening, please confirm:

JavaScript Framework

React Native

Amplify APIs

DataStore

Amplify Version

v5

Amplify Categories

storage, api

Backend

Amplify CLI

Environment information

# Put output below this line
**Issue: AWS Amplify DataStore Sync Problem**

**Description**: The AWS Amplify DataStore is not functioning correctly when data is inserted using DataStore.save(). Occasionally, the data does not sync with the server and remains only in the local storage (DynamoDB). After some time, the data eventually syncs with the server.

**Library Versions:**

- @aws-amplify/datastore-storage-adapter: ^1.4.5
- aws-amplify: ^5.3.10 
- react-native:0.68.2


Describe the bug

Issue: AWS Amplify DataStore Sync Problem

Description: The AWS Amplify DataStore is not functioning correctly when data is inserted using DataStore.save(). Occasionally, the data does not sync with the server and remains only in the local storage (DynamoDB). After some time, the data eventually syncs with the server.

Library Versions:

  • @aws-amplify/datastore-storage-adapter: ^1.4.5
  • aws-amplify: ^5.3.10
  • react-native:0.68.2

Expected behavior

All data is also synchronised via the datastore

Reproduction steps

  1. Create data with DataStore and AWS GraphQL
  2. Check the code logs
  3. Check the data in DynamoDB, but note that there might be some issues or additional information to review

Code Snippet

// Put your code below this line.

const dataCollection = {
sessionDuration: dataResponse[0]?.sessionDuration,
collectionStorage: dataResponse[0]?.collectionStorage,
currentStorageLocation: privousCollectionData[0]
?.previousCurrentStorageLocation
? privousCollectionData[0]?.previousCurrentStorageLocation
: dataResponse[0]?.currentStorageLocation,
CollectionUsedDate: null,
isCollectionUsed: false,
storeReferenceId: privousCollectionData[0]?.previousStoreReferenceId,
collectionUsedBy: '',
otherUsedMessage: null,
isActivityFinish: true,
collectionId: null,
id: privousCollectionData[i]?.id,
locationChangeDate:
privousCollectionData[0]?.previousLocationChangeDate,
storageExpiryAlert:
privousCollectionData[0]?.previousStorageExpiryAlert,
storageExpiry: privousCollectionData[0]?.previousStorageExpiry,
updatedAt: currentUTCTime(),
activityType: 'Collection',
activitySide: dataResponse[0]?.activitySide,
activityEndTime: privousCollectionData[0]?.previousActivityEndTime,
sessionEndTime: privousCollectionData[0]?.previousSessionEndTime,
previousStoreReferenceId: '',
previousStorageExpiryAlert: '',
previousLocationChangeDate: '',
previousCurrentStorageLocation:
privousCollectionData[0]?.previousCurrentStorageLocation,
previousStorageExpiry: '',
previousActivityEndTime: '',
previousSessionEndTime: '',
subjectId: '',
stashTotalFeed: '',
activityDoneVia: dataResponse[0]?.activityDoneVia,
activityDuration:dataResponse[0]?.activityDuration,
sessionStartTime:dataResponse[0]?.sessionStartTime,
subjectAvatarName:dataResponse[0]?.subjectAvatarName,
activityStartTime:dataResponse[0]?.activityStartTime,
unitOfMeasurement:dataResponse[0]?.unitOfMeasurement,
appId:dataResponse[0]?.appId,
_deleted:dataResponse[0]?._deleted,
preStorageLocation:dataResponse[0]?.preStorageLocation,
stashUsedCollectionId:dataResponse[0]?.stashUsedCollectionId,
stashStart:dataResponse[0]?.stashStart,
vijay:dataResponse[0]?.vijay,
createdAt:dataResponse[0]?.createdAt,
deviceType:dataResponse[0]?.deviceType,
_lastChangedAt:dataResponse[0]?._lastChangedAt,
isSync:dataResponse[0]?.isSync,
owner:dataResponse[0]?.owner,
collectionStorageUsed:String(dataResponse[0]?.collectionStorageUsed),
sessionId:dataResponse[0]?.sessionId,
};

// Code for data save
const response = await DataStore.save(new Activity(dataCollection))

Log output

// Put your logs below this line


aws-exports.js

No response

Manual configuration

No response

Additional configuration

No response

Mobile Device

iPhone 15

Mobile Operating System

No response

Mobile Browser

No response

Mobile Browser Version

No response

Additional information and screenshots

No response

@github-actions github-actions bot added pending-triage Issue is pending triage pending-maintainer-response Issue is pending a response from the Amplify team. labels Sep 19, 2024
@cwomack cwomack added duplicate If marked with duplicate, issue will be closed & original will be added for traceability and removed pending-triage Issue is pending triage labels Sep 19, 2024
@cwomack
Copy link
Member

cwomack commented Sep 19, 2024

@vijaykishan312, closing this issue because it appears that there was a duplicate (exact match) opened up with #13833.

@cwomack cwomack closed this as not planned Won't fix, can't repro, duplicate, stale Sep 19, 2024
@github-actions github-actions bot removed the pending-maintainer-response Issue is pending a response from the Amplify team. label Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate If marked with duplicate, issue will be closed & original will be added for traceability
Projects
None yet
Development

No branches or pull requests

2 participants