Xamarin example with Gateway from Walrus to server


Just succesfully got the example working: xamarin userprofile_sync

Using docker for both couchdb and the gateway. Gateway runs in walrus mode and that works. But now I switched to my real database but this does not work.

The relevant configuration change:
“userprofile”: {
“users”: { "demo@example.com": { “password”: “password”} },
“server”: “”,
“bucket”: “default”,
“num_index_replicas”: 0,
“username”: “Administrator”,
“password”: “********”,

Since I get errors about posting links I cannot add a complete log :frowning:

2019-10-15T11:28:33.770Z [INF] Sync: c:[2199f648] Sent all changes to client

The clients however do not update. What can be wrong here?

Regards, Rob

Save it to a gist and post a link here. It’s not good form to paste long logs into forum threads anyway.

I am a bit further and found quite a lot erros on my side.

However, now I am receiving the following error:
2020-03-04T12:18:26.305Z [INF] HTTP: #013: GET /taakbeheerser/_blipsync
2020-03-04T12:18:26.307Z [INF] HTTP auth failed for username=" test"
2020-03-04T12:18:26.307Z [INF] HTTP: #013: --> 401 Invalid login (2.6 ms)

The config is in my next message.

“log”: ["*"],
“databases”: {
“taakbeheerser”: {
“server”: “”,
“users”: { “test”: { “password”: “password”} },
“bucket”: “default”,
“username”: “sync_gateway”,
“password”: “password”,
“enable_shared_bucket_access”: true,
“import_docs”: “continuous”,
“num_index_replicas”: 0,
“sync”: function (doc, oldDoc) { if (doc.sdk) { channel(doc.sdk); } }
I am supplying the users credential to the BasicAuthenticator for replication. When starting the replicator I see the invalid login in the log file.

Additional question is: I want to have the data in the local db also in the cloud database. How is this supposed to be configured? Are changes via the gateway pushed to the database? In other words, if the auth problem is fixed changes are committed to the couchbase cloud db?

Regards, Rob

HTTP auth failed for username=" test"

There’s a space at the start of the username.

Yes, that’s what the Couchbase Lite replicator does. If you enable pull replication, changes on the server get pulled into the device. If you enable push, changes from the device get pushed to the server.

Oops… I overlooked that, thanks! Now the invalid login is gone.

Once I add something via one instance of the application it is now added in the remote db too. If I start another instance of the application the remote data is not arriving on this instance. I see the events coming in.

A bit further now. Changes are stored in the database but not distributed to other clients. Also a new client does not get the existing data.

I introduced a doc_type and use that as channel. So I subscribe to that channel for replication and also the sync function notifies the channel:

"sync": `function (doc, oldDoc) {
    if (doc.doc_type) {
      channel("channel." + doc.doc_type);

So what should I do to get the (initial) sync working? I am using the same user accont for multiple clients like the example with the user profile.

Does your user account have access to the channels that the documents are added to? It sounds like it doesn’t.

Where do I define that? I see that with a user I can specify admin channels but in the examples I don’t see any further configuration unless I overlooked something?

You can either specify admin channels in the config, or use the sync function to dynamically assign users or roles to get access to the channel.