Skip to content

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

Description

@aszs

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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions