amazon-archives / amazon-cognito-js

Amazon Cognito Sync Manager for JavaScript
http://aws.amazon.com/cognito
Apache License 2.0
202 stars 83 forks source link

deleted records can not be added again #61

Open zoul0813 opened 6 years ago

zoul0813 commented 6 years ago

I'm attempting to create a dictionary of values in a dataset, when I add a key to the dataset and synchronize everything works fine. If I delete that key by calling dataset.remove and synchronize everything works fine here too.

The problem is when I try to add that same key back in after it's been removed previously and synchronize. My local dataset shows the value, and when I call dataset.synchronize none of my callbacks are being fired ... but I can see the request in Chrome's network log, as well as in the Cognito Sync Event trigger that is being called.

I enabled logging on the sync manager, and during a successful sync (adding or removing the item for the first time), I get a sync successful message ... however, when trying to add the item back in and sync, the last message I get is Nothing updated remotely. Pushing local changes to remote.

zoul0813 commented 6 years ago

I did a few more tests, it looks like the issue is related to Cognito Sync Events.

When the remote record is marked as deleted, the Cognito Sync Event trigger is calling the lambda function with 'recordKey': null rather than 'recordKey': { oldValue: null, newValue: 'whatever', op: 'replace' }