Channelising in CouchBase Sync Gateway calling infinitely post calls



I am trying to push data in CouchBase Server through CouchBase Lite via sync gateway. I am able to successfully create users and assign channels to them and then send Documents to CouchBase Server via correct channels. What I am not able to do is pull the documents from CouchBase server to CouchBase Lite via sync gateway. This issue is only occuring when I create channels and users via sync gateway rest API. If I dont assign any channels to documents then I am succesfully able to push and pull documents. Secondly When I create users and channels directly in sync gateway config file then also everything is working but when I am creating users and channels via sync gateway REST API then only the issue is occuring. The error I am getting in android studio log is

PullerInternal{unknown, pull, 93166}: Received invalid doc ID from _changes: {seq=4, id=_user/an, changes=[]}

and on the sync gateway terminal I see the below log running infinitely

2016-05-10T15:43:43.937+05:30 HTTP:  #46236: POST /sync_gateway/_changes  (as an)
2016-05-10T15:43:43.937+05:30 Changes+: Int sequence multi changes feed...
2016-05-10T15:43:43.937+05:30 Changes: MultiChangesFeed({u1}, {Since:2 Limit:50 Conflicts:true IncludeDocs:false Wait:true Continuous:false Terminator:0xc820bcefc0 HeartbeatMs:300000 TimeoutMs:300000 ActiveOnly:false}) ...   (to an)
2016-05-10T15:43:43.938+05:30 Changes+: MultiChangesFeed: channels expand to channels.TimedSet{} ...   (to an)
2016-05-10T15:43:43.938+05:30 Changes+: MultiChangesFeed waiting...   (to an)
2016-05-10T15:43:43.938+05:30 Changes+: Waiting for "sync_gateway"'s count to pass 3
2016-05-10T15:43:43.938+05:30 Changes: MultiChangesFeed done   (to an)

Below is the document of user I created by REST API

  "name": "an",
  "all_channels": {
    "!": 1
  "sequence": 2,
  "passwordhash_bcrypt": "JDJhJDEwJGVwS1FaQjY1UEUuTUJSWnhuMFY1VmVkZ3EuMzEvajRjLzVmMDJiVmdsNVlFM3FSVkxjQkRp",
  "rolesSince": {}

and Below is the document of user created by hardcoding in config.json

  "name": "user1",
  "admin_channels": {
    "u2": 4
  "all_channels": {
    "!": 1,
    "u2": 4
  "sequence": 4,
  "passwordhash_bcrypt": "JDJhJDEwJDJhVWR6RWYveU4wYjVMdDk1Q1BSRWVrdVVTaXlrdGlsY0cxeHV5MGdYbFF2eFZqVE5CMzJ1",
  "rolesSince": {}

I see there are differences in both documents so how can I remove those differences because that is creating the problem

Now when I changed the users’s document (manually) which I created using rest API(to match the user document created by config file) It is working. So issue seems to be with creation of rest API. How can I create it correctly using REST API?


The ‘invalid doc ID’ message you’re seeing in Android studio should just be a warning, not an error, so I don’t think that’s your issue.

It looks like the user that you’re creating via the REST API doesn’t have any channels assigned to them. Are you setting the admin_channels property when you create the user, or are you trying to assign channels via the sync function?


Thanx it helped. It seems like I wasnt providing the correct JSON to create the users