Node.js 无法连接到Mongo Atlas getaddrinfo ENOTFOUND[群集名称]
使用Botkit创建slack bot,但无法连接到Mongo Atlas进行存储。Nodejs后端。使用Botkit存储mongo 代码:Node.js 无法连接到Mongo Atlas getaddrinfo ENOTFOUND[群集名称],node.js,mongodb,bots,slack,mongodb-atlas,Node.js,Mongodb,Bots,Slack,Mongodb Atlas,使用Botkit创建slack bot,但无法连接到Mongo Atlas进行存储。Nodejs后端。使用Botkit存储mongo 代码: var Botkit = require('botkit'); var BotkitStorage = require('botkit-storage-mongo'); storage = BotkitStorage({ mongoUri: `mongodb+srv://<username>:<password>@<clust
var Botkit = require('botkit');
var BotkitStorage = require('botkit-storage-mongo');
storage = BotkitStorage({ mongoUri: `mongodb+srv://<username>:<password>@<clustername>/test?retryWrites=true&w=majority`})
在Mongo Atlas,
我的IP地址被列入白名单。
还测试了允许所有IP:0.0.0.0/0
关于为什么我不能连接有什么想法吗 这个问题与botkit无关 需要更新mongo atlas仪表板中的连接驱动程序版本
Was Node.js 3.0或更高版本的驱动程序。当我将其更改为Node.js 2.2.12或更高版本时,该连接字符串起作用 这个问题与botkit无关 需要更新mongo atlas仪表板中的连接驱动程序版本 Was Node.js 3.0或更高版本的驱动程序。当我将其更改为Node.js 2.2.12或更高版本时,该连接字符串起作用
UnhandledPromiseRejectionWarning: Error: MongoError: failed to connect to server [<cluster_name>] on first connect [Error: getaddrinfo ENOTFOUND <cluster_name>
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:60:26) {
name: 'MongoError',
message: 'getaddrinfo ENOTFOUND <cluster_name>'
}]
"dependencies": {
"botkit": "0.6.21",
"botkit-storage-mongo": "1.0.7",
"mongodb": "^3.5.0"
}