Skip to content
This repository has been archived by the owner on Jan 15, 2021. It is now read-only.

Mongoose / MongoDB error (related to replica set maybe)? #105

Open
krstffr opened this issue May 15, 2017 · 7 comments
Open

Mongoose / MongoDB error (related to replica set maybe)? #105

krstffr opened this issue May 15, 2017 · 7 comments

Comments

@krstffr
Copy link

krstffr commented May 15, 2017

Just installed glimpse and tried running it in a very simple application, which basically does a .find on some Mongoose model, and it throws the error below.

Update when looking deeper into this: This only occurs when I connect to a replica set hosted on MongoDB Atlas though, not when running a single mogod on my own computer.

Versions
Mongoose: 4.9.9
Express: 4.15.2
Node: 6.10.3

TypeError: Cannot read property 'availableConnections' of undefined
    at Function.MongoDBInspector.GetConnectionInfoFromCursor (/APP_PATH/node_modules/@glimpse/glimpse-agent-node/release/inspectors/MongoDBInspector.js:537:40)
    at MongoDBInspector.readStartInspector (/APP_PATH/node_modules/@glimpse/glimpse-agent-node/release/inspectors/MongoDBInspector.js:461:51)
    at Object.listeners._a.(anonymous function) [as listener] (/APP_PATH/node_modules/@glimpse/glimpse-agent-node/release/inspectors/MongoDBInspector.js:144:23)
    at Tracing.publish (/APP_PATH/node_modules/@glimpse/glimpse-agent-node/release/tracing/Tracing.js:31:26)
    at MongoDBProxy.cursorStartReadProxyCallbackOrPromise (/APP_PATH/node_modules/@glimpse/glimpse-agent-node/release/tracing/module_instrumentors/MongoDBProxy.js:131:31)
    at Cursor.proxy [as toArray] (/APP_PATH/node_modules/@glimpse/glimpse-agent-node/release/tracing/module_instrumentors/MongoDBProxy.js:63:40)
    at /APP_PATH/node_modules/mquery/lib/collection/node.js:29:12
    at handleCallback (/APP_PATH/node_modules/mongodb/lib/utils.js:120:56)
    at Collection.find (/APP_PATH/node_modules/mongodb/lib/collection.js:385:44)
    at NativeCollection.(anonymous function) [as find] (/APP_PATH/node_modules/mongoose/lib/drivers/node-mongodb-native/collection.js:126:28)
    at NodeCollection.find (/APP_PATH/node_modules/mquery/lib/collection/node.js:26:19)
    at Query.find (/APP_PATH/node_modules/mquery/lib/mquery.js:1730:20)
    at Query._find (/APP_PATH/node_modules/mongoose/lib/query.js:1135:26)
    at /APP_PATH/node_modules/kareem/index.js:257:8
    at /APP_PATH/node_modules/kareem/index.js:23:7
    at wrappedCallback (/APP_PATH/node_modules/@glimpse/glimpse-agent-node/release/async-track/async-track.js:293:33)
@nikmd23
Copy link
Member

nikmd23 commented May 15, 2017 via email

@krstffr
Copy link
Author

krstffr commented May 15, 2017

From my yarn.lock file:

mongodb-core@2.1.10:
  version "2.1.10"
  resolved "https://registry.yarnpkg.com/mongodb-core/-/mongodb-core-2.1.10.tgz#eb290681d196d3346a492161aa2ea0905e63151b"
  dependencies:
    bson "~1.0.4"
    require_optional "~1.0.0"

mongodb@2.2.26:
  version "2.2.26"
  resolved "https://registry.yarnpkg.com/mongodb/-/mongodb-2.2.26.tgz#1bd50c557c277c98e1a05da38c9839c4922b034a"
  dependencies:
    es6-promise "3.2.1"
    mongodb-core "2.1.10"
    readable-stream "2.2.7"

mongoose@^4.9.3:
  version "4.9.9"
  resolved "https://registry.yarnpkg.com/mongoose/-/mongoose-4.9.9.tgz#8671fbe06c945f55fba7ad03797bc02f19516762"
  dependencies:
    async "2.1.4"
    bson "~1.0.4"
    hooks-fixed "2.0.0"
    kareem "1.4.1"
    mongodb "2.2.26"
    mpath "0.2.1"
    mpromise "0.5.5"
    mquery "2.3.0"
    ms "0.7.2"
    muri "1.2.1"
    regexp-clone "0.0.1"
    sliced "1.0.1"```

@mike-kaufman
Copy link
Contributor

Thanks for reporting this @krstffr. Any chance you can get us a small project that reproduces the issue? I'll take a quick look at our logic. I thought our mongo DB instrumentation was turned off at the moment...

@krstffr
Copy link
Author

krstffr commented May 16, 2017

Hi @mike-kaufman, the problem though is that it works when using my local DB, but not when I'm using the MongoDB Atlas one, so I might be able to set up this testv app for you if you yourselves are willing to set up an Atlas DB account etc since I unfortunately can't lend you mine?

@mike-kaufman
Copy link
Contributor

Thanks @krstffr. I'll see if I can set up an atlas DB & repro this...

@krstffr
Copy link
Author

krstffr commented May 17, 2017

Cool @mike-kaufman, thanks a lot!

@azappa
Copy link

azappa commented May 18, 2017

Got the same error too with compose.io (db got replica) using https://github.com/Automattic/monk.

@mike-kaufman mike-kaufman added this to the M022 milestone May 31, 2017
@mike-kaufman mike-kaufman removed this from the M022 milestone Aug 7, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants