Could not connect to the database. Exiting now... MongooseServerSelectionError: connection timed out

 Getting the following error in AWS, while trying to run node js docker container


[2022-12-19T19:03:56.378] [ERROR] server:825 Could not connect to the database. Exiting now... MongooseServerSelectionError: connection timed out

    at NativeConnection.Connection.openUri (/app/node_modules/mongoose/lib/connection.js:825:32)

    at /app/node_modules/mongoose/lib/index.js:417:10

    at /app/node_modules/mongoose/lib/helpers/promiseOrCallback.js:41:5

    at new Promise (<anonymous>)

    at promiseOrCallback (/app/node_modules/mongoose/lib/helpers/promiseOrCallback.js:40:10)

    at Mongoose._promiseOrCallback (/app/node_modules/mongoose/lib/index.js:1270:10)

    at Mongoose.connect (/app/node_modules/mongoose/lib/index.js:416:20)

    at Object.<anonymous> (/app/server.js:30:10)

    at Generator.next (<anonymous>) {

  reason: TopologyDescription {

    type: 'Unknown',

    servers: Map(1) { '3.129.14.175:27017' => [ServerDescription] },

    stale: false,

    compatible: true,

    heartbeatFrequencyMS: 10000,

    localThresholdMS: 15,

    setName: null,

    maxElectionId: null,

    maxSetVersion: null,

    commonWireVersion: 0,

    logicalSessionTimeoutMinutes: null

  },

  code: undefined



Make sure that the node.js app configuration uses the white listed mongo db internal IP address.

No comments:

 Python Basics How to check the version of Python interpreter mac terminal

Popular in last 30 days