Issue connecting to Mongo Atlas from Apostrophe CM

2019-08-18 22:38发布

问题:

I followed the instructions here to deploy my apostrophe cms website to aws elastic beanstalk.

The mongodb doesn't have any whitelisting restrictions and is open to everyone.

I set db coonection string as an environment variable using eb setenv APOS_BUNDLE=prod-bundle APOS_MINIFY=1 APOS_MONGODB_URI=mongodb://admin:password@cluster0-shard-00-00-xyz.mongodb.net:27017,cluster0-shard-00-01-xyz.mongodb.net:27017,cluster0-shard-00-02-xyz.mongodb.net:27017/demo-io?ssl=true&replicaSet=Cluster0-shard-0&authSource=admin&retryWrites=true

I have added the same values to these environment variables using beanstalk dashboard as well.

The health status is "Degraded".

The logs are :

/var/log/nodejs/nodejs.log

ERROR: There was an issue connecting to the database. Is it running?

/var/app/current/node_modules/apostrophe/index.js:67
        throw err;
        ^
MongoError: seed list contains no mongos proxies, replicaset 
connections requires the parameter replicaSet to be supplied in the 
URI or options object, mongodb://server:port/db?replicaSet=name
    at connectCallback 
(/var/app/current/node_modules/mongodb/lib/mongo_client.js:523:23)
    at 
/var/app/current/node_modules/mongodb/lib/mongo_client.js:418:11
    at _combinedTickCallback (internal/process/next_tick.js:73:7)
    at process._tickCallback (internal/process/next_tick.js:104:9)
ERROR: There was an issue connecting to the database. Is it running?

`

I am able to connect my local application to db on Mongo Atlas by editing data/local.js file using the same connection string.

I am able to access the db on mongo atlas from the terminal as well. What am I missing?