Please help me to fix below error. It is occurring while connecting to mongoDB.
Please find below error for you reference.
Database Connected Successfully
eCommerce API listening on PORT: 5454
D:\REBOOT\All projects\E-commerce\e-Commerce\shopping-App-Api\node_modules\mongoose\lib\connection.js:805
err = new ServerSelectionError();
^
MongooseServerSelectionError: Could not connect to any servers in your MongoDB Atlas cluster. One common reason is that you're trying to access the database from an IP that isn't whitelisted. Make sure your current IP address is on your Atlas cluster's IP whitelist: https://www.mongodb.com/docs/atlas/security-whitelist/
at _handleConnectionErrors (D:\REBOOT\All projects\E-commerce\e-Commerce\shopping-App-Api\node_modules\mongoose\lib\connection.js:805:11)
at NativeConnection.openUri (D:\REBOOT\All projects\E-commerce\e-Commerce\shopping-App-Api\node_modules\mongoose\lib\connection.js:780:11)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
reason: TopologyDescription {
type: 'ReplicaSetNoPrimary',
servers: Map(3) {
'ac-ecpfkt4-shard-00-01.8htybfs.mongodb.net:27017' => ServerDescription {
address: 'ac-ecpfkt4-shard-00-01.8htybfs.mongodb.net:27017',
type: 'Unknown',
hosts: [],
passives: [],
arbiters: [],
tags: {},
minWireVersion: 0,
maxWireVersion: 0,
roundTripTime: -1,
lastUpdateTime: 1290704390,
lastWriteDate: 0,
error: MongoNetworkError: connect ETIMEDOUT 64:ff9b::3e7:688b:27017
at connectionFailureError (D:\REBOOT\All projects\E-commerce\e-Commerce\shopping-App-Api\node_modules\mongodb\lib\cmap\connect.js:367:20)
at TLSSocket.<anonymous> (D:\REBOOT\All projects\E-commerce\e-Commerce\shopping-App-Api\node_modules\mongodb\lib\cmap\connect.js:290:22)
at Object.onceWrapper (node:events:629:26)
at TLSSocket.emit (node:events:514:28)
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
cause: Error: connect ETIMEDOUT 64:ff9b::3e7:688b:27017
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1495:16) {
errno: -4039,
code: 'ETIMEDOUT',
syscall: 'connect',
address: '64:ff9b::3e7:688b',
port: 27017
},
[Symbol(errorLabels)]: Set(1) { 'ResetPool' }
},
topologyVersion: null,
setName: null,
setVersion: null,
electionId: null,
logicalSessionTimeoutMinutes: null,
primary: null,
me: null,
'$clusterTime': null
},
'ac-ecpfkt4-shard-00-02.8htybfs.mongodb.net:27017' => ServerDescription {
address: 'ac-ecpfkt4-shard-00-02.8htybfs.mongodb.net:27017',
type: 'Unknown',
hosts: [],
passives: [],
arbiters: [],
tags: {},
minWireVersion: 0,
maxWireVersion: 0,
roundTripTime: -1,
lastUpdateTime: 1290704397,
lastWriteDate: 0,
error: MongoNetworkError: connect ETIMEDOUT 64:ff9b::2ccd:abfc:27017
at connectionFailureError (D:\REBOOT\All projects\E-commerce\e-Commerce\shopping-App-Api\node_modules\mongodb\lib\cmap\connect.js:367:20)
at TLSSocket.<anonymous> (D:\REBOOT\All projects\E-commerce\e-Commerce\shopping-App-Api\node_modules\mongodb\lib\cmap\connect.js:290:22)
at Object.onceWrapper (node:events:629:26)
at TLSSocket.emit (node:events:514:28)
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
cause: Error: connect ETIMEDOUT 64:ff9b::2ccd:abfc:27017
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1495:16) {
errno: -4039,
code: 'ETIMEDOUT',
syscall: 'connect',
address: '64:ff9b::2ccd:abfc',
port: 27017
},
[Symbol(errorLabels)]: Set(1) { 'ResetPool' }
},
topologyVersion: null,
setName: null,
setVersion: null,
electionId: null,
logicalSessionTimeoutMinutes: null,
primary: null,
me: null,
'$clusterTime': null
},
'ac-ecpfkt4-shard-00-00.8htybfs.mongodb.net:27017' => ServerDescription {
address: 'ac-ecpfkt4-shard-00-00.8htybfs.mongodb.net:27017',
type: 'Unknown',
hosts: [],
passives: [],
arbiters: [],
tags: {},
minWireVersion: 0,
maxWireVersion: 0,
roundTripTime: -1,
lastUpdateTime: 1290704399,
lastWriteDate: 0,
error: MongoNetworkError: connect ETIMEDOUT 64:ff9b::36a3:6458:27017
at connectionFailureError (D:\REBOOT\All projects\E-commerce\e-Commerce\shopping-App-Api\node_modules\mongodb\lib\cmap\connect.js:367:20)
at TLSSocket.<anonymous> (D:\REBOOT\All projects\E-commerce\e-Commerce\shopping-App-Api\node_modules\mongodb\lib\cmap\connect.js:290:22)
at Object.onceWrapper (node:events:629:26)
at TLSSocket.emit (node:events:514:28)
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
cause: Error: connect ETIMEDOUT 64:ff9b::36a3:6458:27017
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1495:16) {
errno: -4039,
code: 'ETIMEDOUT',
syscall: 'connect',
address: '64:ff9b::36a3:6458',
port: 27017
},
[Symbol(errorLabels)]: Set(1) { 'ResetPool' }
},
topologyVersion: null,
setName: null,
setVersion: null,
electionId: null,
logicalSessionTimeoutMinutes: null,
primary: null,
me: null,
'$clusterTime': null
}
},
stale: false,
compatible: true,
heartbeatFrequencyMS: 10000,
localThresholdMS: 15,
setName: 'atlas-l241xu-shard-0',
maxElectionId: null,
maxSetVersion: null,
commonWireVersion: 0,
logicalSessionTimeoutMinutes: null
},
code: undefined
}
As the error says that ip is not Whitelisted in atlas. I followed step to whitelist but still it is giving me a same error.
Please help me to fix this