-
Type:
Task
-
Resolution: Gone away
-
Priority:
Major - P3
-
None
-
Affects Version/s: 4.0.0
-
Component/s: None
-
None
-
Not Needed
-
None
-
None
-
None
-
None
-
None
-
None
Hey there,
I want to use the Node native driver to connect to an AWS document db engine version 4. So I used your node module version 4.0.0-beta2. I'm trying to connect with the following code:
const {MongoClient} = require('mongodb') // or as an es module: // import { MongoClient } from 'mongodb' // Connection URL const url = `mongodb://username:password@localhost:27017/test` const client = new MongoClient(url, { tlsAllowInvalidHostnames: false, tlsCAFile: "./src/rds-combined-ca-bundle.pem", sslValidate: false, serverSelectionTimeoutMS: 3000, useUnifiedTopology: true, }) // Database Name const dbName = 'myProject' async function main() { // Use connect method to connect to the server await client.connect() console.log('Connected successfully to server') const db = client.db(dbName) const collection = db.collection('documents') // the following code examples can be pasted here... return 'done.' } main() .then(console.log) .catch(console.error) .finally(() => client.close())
This yields the error message:
MongoServerSelectionError: Server selection timed out after 3000 ms
at Timeout._onTimeout (/long/path/node_modules/mongodb/lib/sdam/topology.js:296:38)
at listOnTimeout (internal/timers.js:554:17)
at processTimers (internal/timers.js:497:7) {
reason: TopologyDescription {
type: 'Unknown',
servers: Map(1) { 'localhost:27017' => [ServerDescription] },
stale: false,
compatible: true,
heartbeatFrequencyMS: 10000,
localThresholdMS: 15,
logicalSessionTimeoutMinutes: undefined
}
}
I'm using an SSH jump host to connect to the document db and I can connect via the CLI through that SSH jump host without problems. The same is true if I downgrade the node module to 3.6.5. Then I'm also able to connect.