Pull Replication works with GUEST and fails with user


I am unable to pull data from couchbase sync-gateway. This is what I am trying

  1. Enabling a user ‘test_user’ from adminInterface
  2. Add documents from REST API to this bucket
  3. Pull data from sync gateway in Android App with ‘testUser’ credentials

This is what my syn gateway config file looks like.

{ "log": ["*"], "databases": { "db": { "server": "", "bucket": "default", "users": { "GUEST": { "disabled": true, "admin_channels": ["*"] } } }, "db_pull": { "server": "", "bucket": "pull", "users": { "GUEST": { "disabled": true, "admin_channels": ["*"] } } } } }
If I make guest enabled and remove authentication from app, I am able to pull data into it.

Can someone please help with what am I missing?


You have not defined a custom sync function so by default when you add documents to Sync Gateway they will be mapped to the channels defined in the “channels” property.

e.g. the following document would be added to a channel named “channel1”


The simplest way to configure your authenticated user to pull replicate from this channel is to set “admin_channels”: ["*"] via the REST API when you create the user.

For more realistic use cases, you can define your own sync function and dynamically map document to channels and assign users access to those channels.

Sync Gateway is installed with an examples folder that contains a range of configuration files, some with complex sync functions.

There are online guides for channels and the sync function.

1 Like