Error in connecting to document DB intermittently

0

Hi,

I am facing the below exception intermittently. I am using the connection as below.

“errorMessage”:“MongoTimeoutError: Server selection timed out after 30000 ms”,“reason”:{“errorType”:“MongoTimeoutError”,“errorMessage”:“Server selection timed out after 30000 ms”,“name”:“MongoTimeoutError”,“stack”:[“MongoTimeoutError: Server selection timed out after 30000 ms”," at Timeout.setTimeout [as _onTimeout] (/var/task/node_modules/mongodb/lib/core/sdam/server_selection.js:308:9)"," at ontimeout (timers.js:436:11)"," at tryOnTimeout (timers.js:300:5)"," at listOnTimeout (timers.js:263:5)"," at Timer.processTimers (timers.js:223:10)"]},“promise”:{},“stack”:[“Runtime.UnhandledPromiseRejection: MongoTimeoutError: Server selection timed out after 30000 ms”," at process.on (/var/runtime/index.js:37:15)"," at process.emit (events.js:198:13)"," at process.EventEmitter.emit (domain.js:448:20)"," at emitPromiseRejectionWarnings (internal/process/promises.js:140:18)"," at process._tickCallback (internal/process/next_tick.js:69:34)"]}

let connectionString = mongodb://${data.username}:${data.password}@${clusterEndpoint}:27017/?ssl=true&ssl_ca_certs=rds-combined-ca-bundle.pem&replicaSet=rs0;
return new Promise((resolve, reject) => {
mongodb.connect(connectionString, { useUnifiedTopology: true }, (err, res) => {
if (err) {
reject(err);
} else {
resolve(res);
}
})
});

質問済み 4年前2584ビュー
2回答
0

Looking at the errors below, seems like your connection is timing out. Timeouts could happen if 1/ The client where your Node.js app is running is in a different VPC/different region than your Amazon DocumentDB cluster 2/ The security group associated with your cluster does not allow inbound connections on port 27017. You mentioned you see the error intermittently. Are there any patterns, triggers that typically cause this? Are there any changes in your environment that would cause this intermittently?

Edited by: AWSMeetB on Sep 10, 2020 11:19 PM

AWS
回答済み 4年前
0

I am also facing this issue intermittently without any pattern. I am using pymongo python client to connect with docdb.

回答済み 3年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ