I have a this simple script:
var cb = require('couchbase');
var bucket;
var connectionSettings = {
'user':'test-bucket',
'password':'test',
'hosts':['localhost:8091'],
'bucket':'test-bucket'
};
cb.connect(connectionSettings, function(e, bucket) {
if (e) {
errorHandler('connect', e);
} else {
console.log('Connection established!');
bucket.get('testObject', function(e, doc) {
if(e) {
errorHandler('get', e);
} else {
console.log(doc);
}
});
}
});
function errorHandler(from, e) {
console.log('Function: ' + from);
console.log(e.message);
console.log(e.stack);
}
I did a fresh install of couchbase server + libcouch + node.js + all modules on my ubuntu 12.04 x64 just to check but I still get this error:
syd@HP-Notebook:~/Desktop$ node test.js
Connection established!
Function: get
Network error
Error: Network error
at makeError (/home/syd/node_modules/couchbase/lib/bucket.js:578:18)
at getParsedHandler (/home/syd/node_modules/couchbase/lib/bucket.js:625:17)
node: ../src/ioplugin.cc:496: virtual int Couchnode::IoOps::updateEvent(lcb_socket_t, void*, short int, void*, void (*)(lcb_socket_t, short int, void*)): Assertion `socket != __null' failed.
Aborted (core dumped)
And here are the code blocks that 578 and 625 errors occur
578:
function makeError(conn, errorCode) {
// Early-out for success
if (errorCode == 0) {
return null;
}
// Build a standard NodeJS Error object with the passed errorCode
var errObj = new Error(conn.strError(errorCode)); // <- 578 error here
errObj.code = errorCode;
return errObj;
}
625:
function getParsedHandler(data, errorCode, key, cas, flags, value) {
// if it looks like it might be JSON, try to parse it
if (/[{[]/.test(value)) {
try {
value = JSON.parse(value);
} catch (e) {
// console.log(“JSON.parse error”, e, value)
}
}
var error = makeError(data[1], errorCode); // <- 625 error here
data[0](error, value, {
id : key,
cas: cas,
flags : flags
});
}
I can’t figure out why is this happening I’m trying to figure it out 2 days now with no luck and it’s driving me nuts.
Any help will be greatly appreciated.
P.S. I cant mine the database using php with no problems at all but with no luck in node.