Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Exception in JS sync function when put empty doc for requireAccess tests #137

andreibaranouski opened this Issue · 4 comments

3 participants

test("requireAccess, put empty doc", function(t){
  // try to put empty doc for coolio user
  var doc = {}
  coax.put([userUrl, "db", "cooliosdoc50"], doc, function(err, ok){
    console.log("put1 for coolio user", err)
    t.ok(err, "shouldn't allow write empty doc(without any grands")
    t.ok(err.error=='Forbidden', "wrong error response for empty doc, expected:{ error: 'Forbidden', reason: 'wrong user' }")      

not sure of the expected response in this case, but also the server response is incorrect

18:06:28.416555 HTTP:  #007: PUT /db/cooliosdoc50  (as coolio)
18:06:28.486407 WARNING: Sync fn exception: TypeError; doc = map[_rev:1-ca9ad22802b66f662ff171f226211d5c _id:cooliosdoc50] -- db.(*Database).getChannelsAndAccess() at crud.go:534
18:06:28.486466 HTTP:  #007:     --> 500 Exception in JS sync function
put1 for coolio user { error: 'Internal Server Error',
  reason: 'Exception in JS sync function' }

ok 10 shouldn't allow write empty doc(without any grands
not ok 11 wrong error response for empty doc, expected:{ error: 'Forbidden', reason: 'wrong user' }
    file:   /Users/andrei/couchbase_src/cblite-tests/node_modules/coax/node_modules/hoax/lib/hoax-core.js
    line:   19
    column: 11
      - getCaller (/Users/andrei/couchbase_src/cblite-tests/node_modules/tap/lib/tap-assert.js:418:17)
      - Function.assert (/Users/andrei/couchbase_src/cblite-tests/node_modules/tap/lib/tap-assert.js:21:16)
      - Test._testAssert [as ok] (/Users/andrei/couchbase_src/cblite-tests/node_modules/tap/lib/tap-test.js:87:16)
      - /Users/andrei/couchbase_src/cblite-tests/tests/sync-function.js:178:4
@jchris jchris was assigned

Chris, maybe we just have to handle this situation in sync-function? If so, then I just will update its


I'm confused. Isn't this a gateway bug, not Couchbase Lite? And if it's a bug in the function, shouldn't the bug be closed?


it can be closed because test sync_function does not handle the creation of empty documents( when doc.channels is not specified).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.