My app can not connect to MongoDB Atlas.
The Url:
mongodb+srv://myusername:password@1lalana-dev.inp06zb.mongodb.net/?retryWrites=true&w=majority
The error:
stderr:
npm WARN lifecycle The node binary used for scripts is /home/c1439621c/nodevenv/1lalana-server/14/bin/node but npm is using /opt/alt/alt-nodejs14/root/usr/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.
MongoServerSelectionError: connect ECONNREFUSED 13.245.246.5:27017
at Timeout._onTimeout (/home/c1439621c/nodevenv/1lalana-server/14/lib/node_modules/mongodb/lib/sdam/topology.js:312:38)
at listOnTimeout (internal/timers.js:557:17)
at processTimers (internal/timers.js:500:7) {
reason: TopologyDescription {
type: 'ReplicaSetNoPrimary',
servers: Map(3) {
'ac-fwv9tmo-shard-00-01.inp06zb.mongodb.net:27017' => [ServerDescription],
'ac-fwv9tmo-shard-00-02.inp06zb.mongodb.net:27017' => [ServerDescription],
'ac-fwv9tmo-shard-00-00.inp06zb.mongodb.net:27017' => [ServerDescription]
},
stale: false,
compatible: true,
heartbeatFrequencyMS: 10000,
localThresholdMS: 15,
setName: 'atlas-109yxn-shard-0',
commonWireVersion: 13,
logicalSessionTimeoutMinutes: 30
}
}
It work fine in local and in Heroku, but not in cPanel.
The IP Access List in MongoDB Atlas is already setup as Everywhere:
0.0.0.0/0 (includes your current IP address)