jkrup/meteor-now

Error when passing MONGO_URL with replica set

Gervwyk opened this issue · 4 comments

anyone know how to set mongo url as env variable using which includes a replica set?
I keep getting Error: query parameter replicaSet is an incomplete value pair
my mongo url is set to:

MONGO_URL='mongodb://xxx:xxx@ccc-0.mongodb.net:27017,ccc-1.mongodb.net:27017,ccc-2.mongodb.net:27017/DBNAME?replicaSet=ccc-0&ssl=true&readPreference=primaryPreferred&w=majority&authSource=admin'

My deploy command looks like this:

meteor-now -e ROOT_URL="https://www.mysite.com" -e MONGO_URL="mongodb://xxx:xxx@ccc-0.mongodb.net:27017,ccc-1.mongodb.net:27017,ccc-2.mongodb.net:27017/DBNAME?replicaSet=ccc-0&ssl=true&readPreference=primaryPreferred&w=majority&authSource=admin"

I've tried all versions of " ' ` types but keep up ending with that error in the deployment log..

Try using now secrets:

now secrets add mongo_url_stg 'mongodb://xxx:xxx@ccc-0.mongodb.net:27017,ccc-1.mongodb.net:27017,ccc-2.mongodb.net:27017/DBNAME?replicaSet=ccc-0&ssl=true&readPreference=primaryPreferred&w=majority&authSource=admin'
meteor-now -e ROOT_URL="https://www.mysite.com" -e MONGO_URL=@mongo_url_stg

Thanks! This solved my issue. Really great work on this package!!

jkrup commented

Glad that worked! Yeah sometimes terminals can act weird when directly typing special characters (like those in mongoURLs), so it's better to use the secrets.

Maybe useful to add this to the readme? Had to search for closed issues to find a solution. Thanks @purplecones for the solution!