Replication issue with users created through the Sync GTW REST Admin API

26 views
Skip to first unread message

Zumo

unread,
Sep 3, 2014, 1:41:15 PM9/3/14
to mobile-c...@googlegroups.com
Hi ,

I have spend a few hours on this issue , I hope someone can find what I am doing obviously wrong 
Thanks in advance for your help


Ok, 
I have a running Sync Gtw (1.0.2) with initially 1 admin user that I have started with the following config :

{
    "adminInterface": ":4303",
    "databases": {
        "testprod": {
            "bucket": "testprod",
            "server": "http://testprod:pa...@127.0.0.1:8091",
            "users": {
                "admin": {
                    "admin_channels": [
                        "app-channel",
                        "mdb-channel",
                        "channel-admin",
                        "contacts"
                    ],
                    "all_channels": [
                        "app-channel",
                        "mdb-channel",
                        "channel-admin",
                        "contacts"
                    ],
                    "email": "admin",
                    "name": "admin",
                    "password": "21232f297a57a5a743894a0e4a801fc3"
                }
            }
        }
    },
    "interface": ":4103",
    "log": [
        "CRUD","CRUD+","HTTP","HTTP+","Access","Cache","Changes","Changes+"
    ]
}


On a mobile app (PhoneGap / couchLite plugin 1.0.2) connecting to this sync GTW with that user, all is OK , it replicates (PULL/PUSH)  OK , the replication finishes and all the data shows up.



Then I create a new user for this Sync GTW using the Sync Gtw ADMIN REST API :

HTTP PUT 
http://manager:1d0258c2440a8d19e716292b231e3190@localhost:4303/testprod/_user/manager
{
          "name": "manager",
          "password": "1d0258c2440a8d19e716292b231e3190",
          "admin_channels": [
            "app-channel",
            "mdb-channel",
            "channel-manager",
            "contacts"
          ],
          "all_channels": [
            "app-channel",
            "mdb-channel",
            "channel-manager",
            "contacts"
          ],
          "email": "admin"
        }

User is created OK


Now, When I replicate from the same mobile app authenticating with that new user, the replication never finishes 

{
   "create_target" : true,
   "source" : "http://manager:1d0258c2440a8d19e716292b231e3190@localhost: 4303/testprod",
   "target" : "testprod_manager",
   "continuous" : true
}

Calling  _active_task  on couchLite  keeps reporting  :

[
    {
        "continuous": true,
        "progress": 100,
        "source": "http://manager: 1d0258c2440a8d19e716292b231e3190@localhost:4103/testprod",
        "status": "Processed 39 / 39 changes",
        "target": "testprod_manager",
        "task": "repl001",
        "type": "Replication",
        "x_active_requests": [
            {},
            {}
        ]
    },
    {
        "continuous": true,
        "source": "testprod_manager",
        "status": "Idle",
        "target": "http://manager: 1d0258c2440a8d19e716292b231e3190@localhost:4103/testprod",
        "task": "repl002",
        "type": "Replication",
        "x_active_requests": []
    }
]

Basically the PULL task never goes to idle state , stays stuck on the 39/39 changes 
Has anyone seen this behaviour ?


If that helps ..
I have noticed that if I change the sequence values back to 1 in the user document _sync:user:manager on the server couchbase bucket (below the admin user), then the replication starts working fine.

_sync:user:manager
{
  "name": "admin",
  "admin_channels": {
    "app-channel": 1,
    "channel-admin": 1,
    "contacts": 1,
    "mdb-channel": 1
  },
  "all_channels": {
    "app-channel": 1,
    "channel-admin": 1,
    "contacts": 1,
    "mdb-channel": 1
  },
  "sequence": 0,
  "passwordhash_bcrypt": "JDJhJDEwJGM2eWRhY1ZFdHoyaGZma0pHOFBncWUxREh3LjFPbFluVHJ1UXRGUlo0dm1CYnU4UEoua1pl",
  "rolesSince": {}
}
Reply all
Reply to author
Forward
0 new messages