Meteor-CollectionFS icon indicating copy to clipboard operation
Meteor-CollectionFS copied to clipboard

Cant upload images in production

Open consciousweb opened this issue 8 years ago • 10 comments

Image upload works fine in local/dev environment but compiled/in production i receive this error when I try to upload an image:

/bundle/programs/server/npm/node_modules/meteor/cfs_gridfs/node_modules/mongodb/lib/mongodb/connection/base.js:246 throw message; ^

Error: Error storing uploaded file to TempStore: Can't get executor for query { "files_id": "5a07798f6ce25b0800871962", "n": { "$gte": 0 } }

at EventEmitter. (packages/cfs_collection.js:186:28) at emitTwo (events.js:92:20) at EventEmitter.emit (events.js:172:7) at Stream. (packages/cfs_tempstore.js:364:10) at emitOne (events.js:82:20) at Stream.emit (events.js:169:7) at Stream._error (/bundle/programs/server/npm/node_modules/meteor/cfs_gridfs/node_modules/gridfs-stream/lib/writestream.js:190:8) at /bundle/programs/server/npm/node_modules/meteor/cfs_gridfs/node_modules/gridfs-stream/lib/writestream.js:128:28 at /bundle/programs/server/npm/node_modules/meteor/cfs_gridfs/node_modules/mongodb/lib/mongodb/gridfs/gridstore.js:524:58 at /bundle/programs/server/npm/node_modules/meteor/cfs_gridfs/node_modules/mongodb/lib/mongodb/gridfs/gridstore.js:474:20 2017-11-11 22:28:33 App1_openinvite SA GridFS - ERROR! { [MongoError: Can't get executor for query { files_id: ObjectId('5a07798f6ce25b0800871962'), n: { $gte: 0 } }] name: 'MongoError', ok: 0, errmsg: 'Can't get executor for query { files_id: ObjectId('5a07798f6ce25b0800871962'), n: { $gte: 0 } }', code: 17241, codeName: 'Location17241' }

consciousweb avatar Nov 11 '17 22:11 consciousweb

I'm having the same problem, would love any advice!

gotjennie avatar Nov 21 '17 01:11 gotjennie

I did not determine the source of the problem, but it seems it was related to the configuration of the mongo server. I use nodechef, and was encountering this issue while using mlab databases with default configuration. The moment I pointed my installation to the default nodechef databases instead image upload worked with no additional configuration required at all.

consciousweb avatar Nov 21 '17 01:11 consciousweb

Same here using heroku and the mlab add-on. Will try a different configuration.

Lucbug avatar Dec 03 '17 18:12 Lucbug

What fixed the problem for me was I ran "db.cfs.images.filerecord.ensureIndex({ files_id : 1, n : 1 })" for all my collections related uploading images

gotjennie avatar Dec 03 '17 18:12 gotjennie

This didn't work for me.

Then I have deleted the db, set up a new mLab. But the images still won't upload. This seems to be in line with @conciousweb.

Lucbug avatar Dec 03 '17 22:12 Lucbug

I actually attempted the suggestion @jenniewerner mentioned first as well, and it did not fix the issue for me either. @jenniewerner are you hosting your databases also with mLab?

consciousweb avatar Dec 04 '17 04:12 consciousweb

I think it may be time for me to give a go at ostrio:files, and S3 integration for persistent files.

Lucbug avatar Dec 04 '17 09:12 Lucbug

+1, how to solve?

thearabbit avatar Oct 27 '18 04:10 thearabbit

The problem disappeared on its own when I left mlab and hosted my database on nodechef where my instance was also located. Cant say for certain what the actual issue was

consciousweb avatar Oct 27 '18 04:10 consciousweb

thanks, for your reply. I tried to build meteor build.. and run my app on Local PC (I don't work). But I work fine on meteor run in development mode

thearabbit avatar Oct 27 '18 07:10 thearabbit