Shadowing is not working: Error unmarshalling doc: Test2


I am using the following config:
“interface”: “:4984”,
“adminInterface”: “:4985”,
“log”: [“CRUD”, “CRUD+”, “HTTP”, “HTTP+”, “Access”, “Cache”, “Shadow”, “Shadow+”, “Changes”, “Changes+”],
“databases”: {
“grocery-sync”: {
“server”: “http://localhost:8091”,
“bucket”: “grocery-sync”,
“sync”: function(doc) {channel(doc.channels);},
“users”: {
“GUEST”: {
“disabled”: false,
“admin_channels”: ["*"]
“shadow”: {
“server”: “http://localhost:8091”,
“bucket”: “main_bucket”

I have created a document for grocery-sync bucket using CouchBase Console (version 3.0.1) which will shadow the document created to main_bucket. But receiving error:
18:36:21.222666 WARNING: changeCache: Error unmarshaling doc “Test2”: – d
b.func·004() at change_cache.go:159

And nothing is being synched to the main_bucket from grocery-sync bucket.

Any ideas?



Try enclosing the sync function in back quotes ‘`’, i.e. change:

“sync”: function(doc) {channel(doc.channels);},


"sync": `function(doc) {channel(doc.channels);}`,


I see that the back quotes are striped from the posts by default.

If you are using them with your sync function, then can you post the Test2 doc her as well.

Also re-reading your post it may be that you are writing the doc to the wrong bucket.

You can only directly create docs in the shadow bucket (main_bucket) using the Couchbase Server Admin console, these will be sync’d to the Sync Gateway bucket (grocery_sync).

If you are writing files to the Sync gateway bucket you must do this via the Sync Gateway REST API, the files will then be sync’d to the shadow bucket.


Yes, after entering the data to “main_bucket”, it synched to grocery-sync bucket properly.
Thanks a lot for the response.