Issue connecting to Mongo Atlas from Apostrophe CMS application on Elastic Beanstalk

↘锁芯ラ 提交于 2019-12-13 03:36:02

问题


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?

来源:https://stackoverflow.com/questions/52039510/issue-connecting-to-mongo-atlas-from-apostrophe-cms-application-on-elastic-beans

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!