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년 전2504회 조회
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년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠