Skip to content
This repository has been archived by the owner on Sep 16, 2020. It is now read-only.

Question: Dataset deleted and created manually trough AWS Console. How to handle this case? #4

Open
konstantinvlasenko opened this issue Apr 20, 2015 · 6 comments
Labels

Comments

@konstantinvlasenko
Copy link

Hi,
I am not sure If I understand how to handle subject. Right now I am always getting exception undefined is not a function inside aws-sdk,js at https://github.com/aws/aws-sdk-js/blob/master/dist/aws-sdk.js#L2857
My code:

AWS.config.credentials.get(function () {
        AWS.config.credentials.getId(function (err, data) {
            var syncClient = new AWS.CognitoSyncManager();
            syncClient.openOrCreateDataset('jobs', function (err, dataset) {
                $interval(function () {
                    dataset.synchronize({
                        onFailure: function (err) {
                            console.log(err);
                        },
                        onSuccess: function (data, newRecords) {
                            dataset.getAll(function (err, records) {
                                var _filtered = _.filter(_.values(records), function (v) {
                                    return !_.isEmpty(v);
                                });
                                $scope.items = _.map(_filtered, function (r) {
                                    return JSON.parse(r);
                                });
                                $scope.$apply();
                            });
                        },
                        onDatasetDeleted: function (dataset, datasetName, callback) {
                            console.log('dataset deleted!');
                            var res = callback(true);
                            console.log(res);
                            return res;
                        }
                    });
                }, 5000);
            });
            $scope.id = data;
            $scope.$apply();
        });
    });

The exception happens inside onDatasetDeleted handler when I call callback(true)

Please, advise.

@turacma
Copy link

turacma commented Apr 20, 2015

Unfortunately there is a bug in the SDK in how it handles deleted datasets. We are aware of the issue and hope to release a fix soon.

Thanks for the report.

@konstantinvlasenko
Copy link
Author

Thank you!
https://forums.aws.amazon.com/thread.jspa?threadID=178748

BTW: Where is definition of _synchronizeInternal function? I can see only 2 calls to this function. But I can't find where it is defined.

@konstantinvlasenko
Copy link
Author

Can we help somehow?:) Where is the issue exactly?

@ChristopheBougere
Copy link

Any news ? I have the same issue, a deleted dataset cause synchronisation issues

@itrestian itrestian added the bug label Jan 8, 2017
@edgarberm
Copy link

We have the same problem but two years later.
Any solution for this or I need dive into library to fix it?

@tqhoughton
Copy link

I believe this is also related to #51

As I said in the other thread, I think this is an issue with the AWS console possibly, and not amazon-cognito-js. Manually created/deleted datasets and their values seem to not register properly.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

6 participants