You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var connectionString = "mongodb://username:password@aws-us-east-1-portal.4.dblayer.com:00000,aws-us-east-1-portal.3.dblayer.com:00000/dbname?ssl=true";
var options = {
"mongos": {
"ssl": true,
"sslValidate": false
}
};
var db = mongojs(connectionString, [...], options);
I recently updated from mongojs 0.14.2 and now I sometimes get this error from the connection:
Object #<CleartextStream> has no method 'unref'
TypeError: Object #<CleartextStream> has no method 'unref'
at Connection.destroy (/app/node_modules/mongojs/node_modules/mongodb/node_modules/mongodb-core/lib/connection/connection.js:441:21)
at /app/node_modules/mongojs/node_modules/mongodb/node_modules/mongodb-core/lib/connection/pool.js:189:7
at Array.forEach (native)
at Pool.destroy (/app/node_modules/mongojs/node_modules/mongodb/node_modules/mongodb-core/lib/connection/pool.js:182:15)
at Server.destroy (/app/node_modules/mongojs/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js:1040:31)
at Server.close (/app/node_modules/mongojs/node_modules/mongodb/lib/server.js:398:17)
at Db.close (/app/node_modules/mongojs/node_modules/mongodb/lib/db.js:357:19)
at /app/node_modules/mongojs/node_modules/mongodb/lib/mongo_client.js:312:14
at /app/node_modules/mongojs/node_modules/mongodb/lib/db.js:234:5
at connectHandler (/app/node_modules/mongojs/node_modules/mongodb/lib/server.js:306:7)
at g (events.js:180:16)
at EventEmitter.emit (events.js:95:17)
at /app/node_modules/mongojs/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js:540:23
at commandCallback (/app/node_modules/mongojs/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js:1161:9)
at Callbacks.emit (/app/node_modules/mongojs/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js:119:3)
at null.messageHandler (/app/node_modules/mongojs/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js:295:23)
It appears to be an issue with the mongodb-core library.
Line 441 is actually commented out, but there is a nearby call to connection.unref() so I'm guessing that's the issue.
It looks liketls.TLSSocket replaced CleartextStream in node v0.10.40.
I'm guessing connection.unref() expects node 0.10.40 or higher.
So mongojs only supports 0.10.40 or higher - does that sound right?
The text was updated successfully, but these errors were encountered:
I filed an issue with mongodb-core and they said mongodb-core 1.3+ requires node 0.12.x or higher.
So looking through mongojs dependencies, mongojs 1.0.1 is the last version that can be used with node 0.10.x.
Here's the actual response from mongodb-core:
mongodb-core 1.3 and higher does not attempt to support node 0.10.x beyond best effort. Socket.unref is unsupported on 0.10.x unfortunately but used in mongodb-core. I would suggest one of three things.
1. Upgrade node to 0.12.x or higher.
2. Open a mongojs ticket asking them to mock out the unref method on the Socket prototype so it becomes a no-op
3. Just mock out the unref method yourself and turn it into a no-op.
var Socket = require('net').Socket;
Socket.prototype.unref = function() {};
I'm using mongojs to connect to a db:
I recently updated from mongojs 0.14.2 and now I sometimes get this error from the connection:
It appears to be an issue with the mongodb-core library.
Line 441 is actually commented out, but there is a nearby call to
connection.unref()
so I'm guessing that's the issue.It looks like
tls.TLSSocket
replacedCleartextStream
in node v0.10.40.I'm guessing
connection.unref()
expects node 0.10.40 or higher.So mongojs only supports 0.10.40 or higher - does that sound right?
The text was updated successfully, but these errors were encountered: