0

I am currently working on a PoC to understand the CouchBase lite sync functionality(with Java application). The pull and push replication worked absolutely fine when the sync-gateway was running locally on my machine.

Now when I move my sync-gateway to a Remote machine, the pull replicator doesn't work. But the push works fine. From the following logs on the client seems like there has been some error with pull replicator.

JavaSQLiteStorageEngine
PULL replication event. Source: com.couchbase.lite.replicator.Replication@29fc9a67 Transition: INITIAL -> RUNNING Total changes: 0 Completed changes: 0
Mar 25, 2016 6:04:53 PM com.couchbase.lite.util.SystemLogger e
SEVERE: ChangeTracker: com.couchbase.lite.replicator.ChangeTracker@2ca40c2c: Change tracker got error 404
Mar 25, 2016 6:04:53 PM com.couchbase.lite.util.SystemLogger e
SEVERE: Sync: Change tracker stopped during continuous replication
PULL replication event. Source: com.couchbase.lite.replicator.Replication@29fc9a67 Transition: RUNNING -> IDLE Total changes: 0 Completed changes: 0
Mar 25, 2016 6:05:04 PM com.couchbase.lite.util.SystemLogger e
SEVERE: ChangeTracker: com.couchbase.lite.replicator.ChangeTracker@1b3ae860: Change tracker got error 404
Mar 25, 2016 6:05:04 PM com.couchbase.lite.util.SystemLogger e
SEVERE: Sync: Change tracker stopped during continuous replication

Following is my sync-gateway logs

2016-03-25T18:19:03.210Z HTTP:  #267: GET /test/_local/fc25dac22b1cec1454f09c3ea41f763bc4a46b20  (as mehtab.syed)
2016-03-25T18:19:03.210Z HTTP: #267:     --> 404 missing  (0.2 ms)
2016-03-25T18:19:03.214Z HTTP:  #268: GET /test/_local/31d8e5f89b0db31be77ea73f950068c2d5fe11f8  (as mehtab.syed)
2016-03-25T18:19:03.214Z HTTP: #268:     --> 404 missing  (0.2 ms)
2016-03-25T18:19:03.340Z HTTP:  #269: GET /test/_changes%3ffeed=normal&heartbeat=300000&style=all_docs&active_only=true?feed=normal&heartbeat=300000&style=all_docs&active_only=true
2016-03-25T18:19:03.340Z HTTP: #269:     --> 404 unknown URL  (0.2 ms)
2016-03-25T18:19:13.475Z HTTP:  #270: GET /test/_changes%3ffeed=normal&heartbeat=300000&style=all_docs&active_only=true?feed=normal&heartbeat=300000&style=all_docs&active_only=true
2016-03-25T18:19:13.475Z HTTP: #270:     --> 404 unknown URL  (0.2 ms)
2016-03-25T18:19:23.601Z HTTP:  #271: GET /test/_changes%3ffeed=normal&heartbeat=300000&style=all_docs&active_only=true?feed=normal&heartbeat=300000&style=all_docs&active_only=true
2016-03-25T18:19:23.601Z HTTP: #271:     --> 404 unknown URL  (0.2 ms)

Further, I am using cookie authentication and following is my sync-gateway configuration.

{
  "interface": "127.0.0.1:4988",
  "adminInterface": "127.0.0.1:4989",
  "log": [
    "CRUD",
    "REST+",
    "Access"
  ],
  "databases": {
    "test": {
      "server": "walrus:",
      "users": {"GUEST": {"disabled": true,"admin_channels": ["*"]}
      },
      "sync": `function sync(doc,oldDoc){
        if(doc.type=="user"){
          channel("u-"+doc._id)
          access(doc.owner,"u-"+doc._id)
        }else if(doc.type=="expense"){
          channel("e-"+doc.owner)
          access(doc.owner,"e-"+doc.owner)
          access(doc.approver,"e-"+doc.owner)
        }else{
          channel(doc.channels)
        }
      }`
    }
  }
}

Does anyone have any idea what might be wrong?

Dnavir
  • 556
  • 3
  • 11
  • Hmmm it looks like the URL query marker `?` is getting encoded mistakenly...(just as a note to whoever comes in to give an actual answer) – borrrden Mar 25 '16 at 23:19
  • Yeah, the changes feed URL makes no sense — besides the over-encoded "?" it's got several repeated parameters. Not being familiar with the Java code I have no idea how this could happen. – Jens Alfke Mar 25 '16 at 23:30
  • After lot of digging I figured out the problem isn't with the couchbase sync . The repeated parameters where added due to some faulty configuration of Nginx server. – Dnavir Mar 29 '16 at 09:12

0 Answers0