jdarling / MongoMQ

MongoMQ is a messaging queue built on top of Node.js and MongoDB's tailable cursors.
MIT License
90 stars 20 forks source link

ReferenceError: options is not defined #18

Closed gregwebs closed 11 years ago

gregwebs commented 11 years ago
node_modules/mongodb/lib/mongodb/connection/server.js:562
        throw err;
              ^
ReferenceError: options is not defined
  at node_modules/mongomq/lib/QueueMonitor.js:191:14
  at Db.collection node_modules/mongodb/lib/mongodb/db.js:462:44)
  at node_modules/mongomq/lib/MongoConnection.js:232:15
  at [object Object].MongoMQ.checkConnection node_modules/mongomq/lib/MongoMQ.js:59:5)
  at [object Object].MongoConnection.collection node_modules/mongomq/lib/MongoConnection.js:230:8)
  at [object Object].QueueMonitor.handleResponse node_modules/mongomq/lib/QueueMonitor.js:180:10)
  at node_modules/mongomq/lib/QueueMonitor.js:225:10
  at node_modules/mongodb/lib/mongodb/cursor.js:786:28
  at [object Object].<anonymous> node_modules/mongodb/lib/mongodb/db.js:1641:20)
  at [object Object].g (events.js:175:14)
  at [object Object].EventEmitter.emit (events.js:106:17)
  at Server.Base._callHandler node_modules/mongodb/lib/mongodb/connection/base.js:409:25)
  at node_modules/mongodb/lib/mongodb/connection/server.js:555:20
  at [object Object].MongoReply.parseBody node_modules/mongodb/lib/mongodb/responses/mongo_reply.js:131:5)
  at [object Object].<anonymous> node_modules/mongodb/lib/mongodb/connection/server.js:514:22)
  at [object Object].EventEmitter.emit (events.js:95:17)
  at [object Object].<anonymous> node_modules/mongodb/lib/mongodb/connection/connection_pool.js:190:13)
  at [object Object].EventEmitter.emit (events.js:98:17)
  at Socket.<anonymous> node_modules/mongodb/lib/mongodb/connection/connection.js:382:22)
  at Socket.EventEmitter.emit (events.js:95:17)
  at Socket.<anonymous> (_stream_readable.js:736:14)
  at Socket.EventEmitter.emit (events.js:92:17)
  at emitReadable_ (_stream_readable.js:408:10)
  at emitReadable (_stream_readable.js:404:5)
  at readableAddChunk (_stream_readable.js:165:9)
  at Socket.Readable.push (_stream_readable.js:127:10)
  at TCP.onread (net.js:511:21)
jdarling commented 11 years ago

I'll look into this. Looks like this is a really old bug that doesn't usually get hit.

jdarling commented 11 years ago

Any chance you have a small test project that hits this?

gregwebs commented 11 years ago

sorry, not from a test project, but code looks like this

queue = new MongoMQ({autoStart:true})
queue.on('upload', process)
queue.emit('upload', data)
jdarling commented 11 years ago

Awesome I'll take a look around and see what I can find/fix.

gregwebs commented 11 years ago

this actually appears to be a normal path of execution to me unless handleResponse is not supposed to be used

jdarling commented 11 years ago

Your fix is actually what I was looking at putting into place, was going to test it out first.

To answer your question, you normally would not call handleResponse directly as it is called by next whenever a new message is available on the queue. There isn't really a reason that you couldn't call handleResponse directly though.

jdarling commented 11 years ago

I'm also going to cleanup and add the uprevs to the Readme before I merge this change on NPM will merge it here on Git first.

gregwebs commented 11 years ago

can you upload to npm?

jdarling commented 11 years ago

3.4 is pushed with the changes to handleResponse, an updated readme.md, and package.json updates

Sorry, had a problem with a conflict at work so had to wait till I was home to do the actual publish.