node.js - Issue connecting to Mongo Atlas from Apostrophe CMS application on Elastic Beanstalk
问题描述
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?
解决方案
推荐阅读
- android - 在 webview 加载 android 应用程序后 Prelaoder 不去
- python - 如何为 vispy.scene 添加标签
- python - 无法安装 Pip |Python
- validation - 如何对强化学习项目进行有效性测试?
- c# - C#在比较2个字符串时识别不同的字符
- java - 如何从字符串 ArrayList 在字符串数组中的随机位置添加元素。在 Android Java 中
- java - Mockito 和 Springboot:如何最好地模拟(Mockito)仅用于特定测试?
- python - 什么时候应该给 ax.imshow() 一个变量名?
- javascript - 如何使用酶和笑话来检测变化的反应状态
- linux - AT&T 32 位程序集在函数调用工作后会推送字符串吗?