mongoose icon indicating copy to clipboard operation
mongoose copied to clipboard

Please help.. I get process.nextTick(function() { throw err; })

Open mithralaya opened this issue 11 years ago • 17 comments

Versions I am using

Ubuntu 14.04
MongoDB 3.0.1 with --storageEngine wiredtiger enabled
Mongoose 4.0.1
Node JS 0.12.2

My Dev environment is Mac and everything works good. I pointed my dev environment to live mongoDB and it works.

But when I try the same in my staging with the above versions I get the below error after a while.

/home/ShopWaveServices/api/Up/CoreDB/node_modules/mongoose/node_modules/mongodb/lib/server.js:228
        process.nextTick(function() { throw err; })
                                            ^
Error
    at Object.<anonymous> (/home/ShopWaveServices/api/Up/CoreDB/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/error.js:42:24)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/home/ShopWaveServices/api/Up/CoreDB/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/index.js:2:17)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)

Please help.

I tried setting up auth in mongod, Ports are open for all the required IP addresses.

Please help me fix this.

Many thanks, Karthik

mithralaya avatar Apr 10 '15 16:04 mithralaya

How are you connecting with mongoose? If the mongod server uses auth, are you specifying auth credentials when you connect?

vkarpov15 avatar Apr 10 '15 16:04 vkarpov15

Thank you for your fast response. It doesn't work even without --auth in mongod.

I get the same error. :)

Thank you..

mithralaya avatar Apr 10 '15 16:04 mithralaya

How are you connecting with mongoose? Can you connect using the shell?

vkarpov15 avatar Apr 10 '15 16:04 vkarpov15

Yes I can connect it with the shell. Also I can connect mongoose without auth credentials in my Dev MacOS machine.

Same code doesnt work in Ubuntu. I also uninstalled and reinstalled mongoose just in the Ubuntu Machine.

Currently I connect without --auth like in my local and it works..

var path = 'mongodb://' + _config.mongoDB.dbHost + ':27017/' + _config.mongoDB.dbName;
        try
        {
            connect = mongoose.connect(path);
            //mongoose.set('debug', true);
        }
        catch(e)
        {
            console.log(e);
        }

I hope I understood your question properly.

Many thanks, Karthik

mithralaya avatar Apr 10 '15 17:04 mithralaya

Hmm can you connect using the mongodb shell on the ubuntu machine? Also, can you make sure the path that you're passing to mongoose.connect() is correct?

vkarpov15 avatar Apr 10 '15 19:04 vkarpov15

No response for a couple weeks and can't repro. Re-open if still its an issue.

vkarpov15 avatar Apr 24 '15 21:04 vkarpov15

This is still reproducible in 4.0.0 module.

luqman523 avatar Jun 17 '15 17:06 luqman523

Please provide steps to repro @luqman523

vkarpov15 avatar Jun 18 '15 02:06 vkarpov15

The matter in discussion can easily be debugged by inspecting the url/uri, and decreasing your timeout. If you find yourself with a timeout error at 1 - 10 ms, it serves as a good sanity check. Otherwise, what you are experiencing is likely due to an improper URL or import that you may also try to substitute as a connection string. In my experience this is not an issue.

aug2uag avatar Sep 03 '15 03:09 aug2uag

I am still getting the same problem process.nextTick(function() { throw err; }) ^ Error: connect ECONNREFUSED 165.225.138.63:27017 at Object.exports._errnoException (util.js:874:11) at exports._exceptionWithHostPort (util.js:897:20) at TCPConnectWrap.afterConnect as oncomplete

Using modulus.io mongodb

ishneetdua avatar Mar 02 '16 23:03 ishneetdua

Can you connect using the mongodb shell?

vkarpov15 avatar Mar 05 '16 17:03 vkarpov15

Make sure you turn on mongodb by running 'mongod' inside your teminal or command line.

azlanjamal avatar Apr 26 '16 06:04 azlanjamal

Same issue :(

process.nextTick(function() { throw err; }) ^ Error: getaddrinfo ENOTFOUND localhost at errnoException (dns.js:44:10) at GetAddrInfoReqWrap.onlookup as oncomplete

anispy211 avatar May 10 '16 18:05 anispy211

Mongo server status: waiting for connections on port 27017

anispy211 avatar May 10 '16 18:05 anispy211

Try 127.0.0.1 instead of localhost

vkarpov15 avatar May 13 '16 14:05 vkarpov15

@vkarpov15 Is there a reason why 127.0.0.1 works but not localhost?

CarlosMed avatar Aug 11 '16 03:08 CarlosMed

Not sure, DNS is up to your OS, mongoose and mongodb don't do anything with that.

vkarpov15 avatar Aug 16 '16 00:08 vkarpov15