vsivsi/meteor-file-collection

Mongo connections with SSL turned on fail with SELF SIGNED CERT error

oceddi opened this issue · 3 comments

When using a MONGO_URL that is connecting to mongodb using ssl=true, an error will occur about using a SELF SIGNED CERTIFICATE. This is because the mongo connection in gridFS_server.coffee isn't passing in an sslCA option in the options object (currently your code hard codes it to an empty object).

It would be nice if you supported an option in your FileCollection to specify these mongodb connection options (i.e. somthing like a mongoOptions attribute).

Line 35 in gridFS_server.coffee would change to something like:

@db = Meteor.wrapAsync(mongodb.MongoClient.connect)(process.env.MONGO_URL, options.mongoOptions ? {})

I tested this on a local branch and it resolved my problem with using your module in meteor with ssl=true in the MONGO_URL.

Good catch. The long-term solution here is for Meteor to update to use the modern MongoDB node.js driver. All of the internal stuff that file-collection does (managing its own connection to Mongo) is because the Meteor driver connection is too out-of-date to properly support gridFS. I have raised this issue with MDG and they haven't acted on it for nearly over a year. 😦

See here for more context: #95 (comment)

Any chance you can put together a PR that resolves this issue?

PR: #127

Great! Closing this one to concentrate on the PR