Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't connect to mongo using mongoose on Node 0.12 or io.js when zones are enabled #48

Open
aszs opened this issue Mar 3, 2015 · 0 comments

Comments

@aszs
Copy link

aszs commented Mar 3, 2015

The following code appears to works on Node 0.10 but not on 0.12 or iojs 1.4.1:

require('zone').enable();
var mongoose = require('mongoose');

mongoose.connect("mongodb://127.0.0.1:27017/test", function(err) {
  console.log("connected to database:", err);
});

On Node 0.12.0 and iojs 1.4.1 the following error is thrown using the zone package from NPM:

connecting to database: [Error: connection closed]
TypeError: undefined is not a function
    at connect (net.js:818:15)
    at net.js:928:9
    at Zone.<anonymous> (dns.js:85:18)
    at Zone._apply (/Users/adam/_dev/base/node_modules/zone/lib/zone.js:597:15)
    at Zone.apply (/Users/adam/_dev/base/node_modules/zone/lib/zone.js:621:23)
    at processCallbacks (/Users/adam/_dev/base/node_modules/zone/lib/scheduler.js:47:10)
    at processQueues (/Users/adam/_dev/base/node_modules/zone/lib/scheduler.js:67:5)
    at EventEmitter._tickCallback (node.js:355:11)
    at Function.Module.runMain (module.js:503:11)
    at startup (node.js:129:16)

The behavior is different when using the latest version of Zone on github, node aborts before calling the example callback:

net.js:806
    var req = new TCPConnectWrap();
              ^
TypeError: undefined is not a function
    at connect (net.js:806:15)
    at net.js:930:9
    at null.<anonymous> (dns.js:371:18)
    at Zone.apply (/Users/adam/_dev/base/node_modules/zone/lib/zone.js:616:15)
    at ZoneCallback.call [as apply] (/Users/adam/_dev/base/node_modules/zone/lib/zone-callback.js:94:31)
    at wrapper [as _onTimeout] (/Users/adam/_dev/base/node_modules/zone/lib/zone.js:758:21)
    at Timer.listOnTimeout (timers.js:88:15)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant