First post, because couchbase has been working really well so far, and this is the first issue that I’m stumped on. I really do appreciate any insights or help that might come from this.
Setup:
Couchbase “version”: "4.0.0-4051-community"
OSX 10.11.6
docker version 1.12.0-a build 11213
Webserver is node 6.4.0 node_modules couchbase npm installation is 2.2.2
Situation: Running almost 800 unit tests with mocha against ottoman models.
Every 2 or 3 or 4 times through the test suite, instead of success, a hard stop without a stack trace comes from the internals.
events.js:160
throw er; // Unhandled 'error' event
^
SyntaxError: Unexpected number in JSON at position 4
at parse (native)
Importantly, this unit test is exercising code to look for a record that doesn’t exist. I’ve added a bunch of debugging statements to ottoman (up to this level everything looks ok, ottoman has the right data) and then traced this problem down the stack to the couchbase javascript library, and finally this code block:
Bucket.prototype._n1qlReq = function(host, q, adhoc, emitter) {
var rows = [];
console.log('this._cb.n1qlquery');
this._cb.n1qlQuery(
host, q, adhoc,
function(errCode, val) {
console.log('n1ql handler called');
The first log statement prints, the second one does not, which takes me down into the c code for this which seems to be this function in operations.cc
NAN_METHOD(CouchbaseImpl::fnN1qlQuery) {
So this is sort of no-man’s land for me and I’m not sure how to debug it further. In another life I’ve used C and C++ so I’ve got the concepts but haven’t done node integrated c programming. Before getting too crazy with that I figure it’s worth asking to see if there’s something obvious that someone will know straight away.
One last note… the token is always different. Examples:
Unexpected token a in JSON at position 1
Unexpected token , in JSON at position 39
Thanks so much for reading and any help on this!