Skip to content
This repository has been archived by the owner on Mar 14, 2019. It is now read-only.

Cant upload images in production #1019

Open
consciousweb opened this issue Nov 11, 2017 · 10 comments
Open

Cant upload images in production #1019

consciousweb opened this issue Nov 11, 2017 · 10 comments

Comments

@consciousweb
Copy link

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' }

@gotjennie
Copy link

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

@consciousweb
Copy link
Author

consciousweb commented Nov 21, 2017

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.

@Lucbug
Copy link

Lucbug commented Dec 3, 2017

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

@gotjennie
Copy link

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

@Lucbug
Copy link

Lucbug commented Dec 3, 2017

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.

@consciousweb
Copy link
Author

consciousweb commented Dec 4, 2017

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?

@Lucbug
Copy link

Lucbug commented Dec 4, 2017

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

@thearabbit
Copy link

+1, how to solve?

@consciousweb
Copy link
Author

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

@thearabbit
Copy link

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants