vsivsi / meteor-file-collection

Extends Meteor Collections to handle file data using MongoDB gridFS.
http://atmospherejs.com/vsivsi/file-collection
Other
159 stars 37 forks source link

Cannot read property 'length' of undefined #41

Closed pajooh closed 9 years ago

pajooh commented 9 years ago

in development server with meteor, everything is fine, when building and use node as server, this error appears:

TypeError: Cannot read property 'length' of undefined
    at processResults (/home/user/bundle/programs/server/npm/vsivsi_file-collection/node_modules/mongodb/lib/mongodb/db.js:1607:31)
    at /home/user/bundle/programs/server/npm/vsivsi_file-collection/node_modules/mongodb/lib/mongodb/db.js:1645:20
    at /home/user/bundle/programs/server/npm/vsivsi_file-collection/node_modules/mongodb/lib/mongodb/db.js:1183:7
    at /home/user/bundle/programs/server/npm/vsivsi_file-collection/node_modules/mongodb/lib/mongodb/db.js:1916:9
    at Server.Base._callHandler (/home/user/bundle/programs/server/npm/vsivsi_file-collection/node_modules/mongodb/lib/mongodb/connection/base.js:448:41)
    at /home/user/bundle/programs/server/npm/vsivsi_file-collection/node_modules/mongodb/lib/mongodb/connection/server.js:481:18
    at [object Object].MongoReply.parseBody (/home/user/bundle/programs/server/npm/vsivsi_file-collection/node_modules/mongodb/lib/mongodb/responses/mongo_reply.js:68:5)
    at [object Object].<anonymous> (/home/user/bundle/programs/server/npm/vsivsi_file-collection/node_modules/mongodb/lib/mongodb/connection/server.js:439:20)
    at [object Object].emit (events.js:95:17)
    at [object Object].<anonymous> (/home/user/bundle/programs/server/npm/vsivsi_file-collection/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:201:13)

/home/user/bundle/programs/server/npm/vsivsi_file-collection/node_modules/mongodb/lib/mongodb/connection/base.js:246
        throw message;      
              ^

i'm using node v0.10.38, meteor v1.1.0.2, and file-collection v1.0.5

vsivsi commented 9 years ago

Appears to be a problem with the version 2.0.x node momgoDB driver that file-collection uses internally. Beyond that observation, there's not much more I can say or do.

Can you please provide precise steps to reproduce this error? Complete with source code for a simple Meteor app that causes this error "when building and use node as server".

pajooh commented 9 years ago

The error occurs in Debian wheezy, but not in Ubuntu trusty! very confusing!!!

vsivsi commented 9 years ago

It's almostly certainly an issue with the mongodb 2.0 node.js driver on that platform.

Try:

mkdir mongotest
cd mongotest
npm install mongodb
cd node_modules/mongodb
npm test
pajooh commented 9 years ago

thank you @vsivsi for considerations i filled a bug report for them

vsivsi commented 9 years ago

@pajooh Sorry I gave you the wrong instructions for testing the mongodb driver...

Try this:

git clone https://github.com/mongodb/node-mongodb-native.git mongotest
cd mongotest
git checkout V2.0.27
npm install
npm test

For the tests to work, you need to have a MongoDB server running on localhost:27017

Most npm packages can be tested the way I described above, but mongodb is different, sorry for any confusion.

pajooh commented 9 years ago

@vsivsi for a quick workaround, what can i do? should i have to downgrade file-collection version?

vsivsi commented 9 years ago

Have other versions of file-collection worked on Wheezy? When did it stop working?

pajooh commented 9 years ago

sorry, the error does not appeared in v1.0.5, i was using v0.3.5. my mistake the combination of file-collection v0.3.5 + mongo 3 raises the error i'm closing this issue

vsivsi commented 9 years ago

Okay, glad you were able to resolve this!