Sync Gateway error

#1

Hey guys,i keep getting this error when i try to pull data from my sever. Could you all please englishten me about it. I can push data but i can’t pull.
“com.couchbase.lite.replicator.ReplicationInternal$4@cc83bac checkSessionAtPath() response: {authentication_handlers=[default, cookie], ok=true, userCtx={channels={!=1}, name=Harris}}”

“07-14 02:33:36.434 14210-14343/com.android.gifts.slidingmenuexample W/Sync: PullerInternal{unknown, pull, 8baa5}: Received invalid doc ID from _changes: {seq=29, id=_user/Harris, changes=[]}”

config.json

{
“log”: [“CRUD+”, “REST+”, “Changes+”, “Attach+”],
“adminInterface”: “127.0.0.1:4985”,
“interface”: “:4984”,
“databases”: {
“foodmenu”: {
“server”: “http://localhost:8091”,
“bucket”:“foodmenu”,
“users”:{
“GUEST”: {“disabled”:false},
“Harris”:
{“password”:“pass”,
“admin_roles”:[“Waiter”]
},
“Joyce”:{
“password”:“pass”,
“admin_roles”: [“Admin”]
},
“Don”:{
“password”:“pass”,
“admin_roles”:[“Chef”]
}
},
“roles” : {
“Waiter”: {“admin_channels”: [“TM”,“AMK”,“CCK”,“EU”]},
“Admin”: {“admin_channels”: [“TM”,“AMK”,“CCK”,“EU”]},
“Chef”: {“admin_channels”: [“TM”,“AMK”,“CCK”,“EU”]}
},

    "sync":` function(doc, oldDoc) {
        switch(doc.security)
         { 
        case"General":
          requireRole(["Waiter","Chef","Admin"]);
          channel(["TM","AMK","CCK","EU"]);
          break; 

          case"private":
          requireRole("Admin");
          channel("TM");
          break;

          default:
           throw({forbidden: "read only!"});

         }
        }`

}
}
}

Replication method

public void startReplications1(Database database) throws CouchbaseLiteException {
    List<String> channels = new ArrayList<String>();
    channels.add("TM");
    channels.add("AMK");
    channels.add("CCK");
    channels.add("EU");
    Replication pull = database.createPullReplication(this.createSyncURL(false));
    Authenticator authenticator = AuthenticatorFactory.createBasicAuthenticator("Harris", "pass");
    pull.setAuthenticator(authenticator);
    pull.setContinuous(true);
    pull.setChannels(channels);
    pull.start();
}
#2

I have just tired, only the role"Admin" which is joyce can pull data while don and harris cant. Any idea why

#3

The “Received invalid doc ID from changes” is just a warning - that should be unrelated to the data issue.

Your roles and channels look generally OK in the config - I don’t see any obvious problems. Based on the logging you’ve got enabled, you should be able to check your Sync Gateway logs to see what channels are being used on Harris’s _changes request - look for an entry like:

Changes+: MultiChangesFeed: channels expand to ...   (to Harris)

If the set of expanded channels looks as expected (“TM”,“AMK”,“CCK”,“EU”), then it’s probably a matter of working out whether the expected data is in those channels.

#4

Hey Thanks for the reply, i will check it out. Anyway, for the sync fucntion , for the access() method, can i put roles instead of the username?

#5

I have checked and here is the result
2016-07-15T10:47:39.463+08:00 Changes: MultiChangesFeed({AMK, CCK, EU, TM}, {Since:0 Limit:0 Conflicts:true IncludeDocs:false Wait:false Continuous:false Terminator:0xc0823d2d20 HeartbeatMs:300000 TimeoutMs:300000 ActiveOnly:true}) … (to Joyce)

2016-07-15T10:47:39.473+08:00 Changes+: MultiChangesFeed: channels expand to channels.TimedSet{“AMK”:channels.VbSequence{VbNo:(*uint16)(nil), Sequence:0x2}, “CCK”:channels.VbSequence{VbNo:(*uint16)(nil), Sequence:0x2}, “EU”:channels.VbSequence{VbNo:(*uint16)(nil), Sequence:0x2}, “TM”:channels.VbSequence{VbNo:(*uint16)(nil), Sequence:0x2}} … (to Joyce)

i sometimes can sync down and i sometimes cant. If lets say i am using two separate mobile phones to access the same couchbase sever, i change to change the Ip according to the phones specific Ip address for the right?