An integration/connection. (MongoDB: connect ETIMEDOUT)

I am getting a connection error(attached the log below). Just so you know, I have:

  1. Changed my region and created two more clusters same errors.
  2. Whitelisted two additional ip addresses from different routers and 4G networks, same error. Replaced the connection strings as well.

Error log:

felix@Felixmanschaft23:~/coding-projects/users-expressjs-api$ npm start

> users-expressjs-api@1.0.0 start
> nodemon

[nodemon] 3.0.2
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): src/**/*
[nodemon] watching extensions: ts,js
[nodemon] starting `ts-node ./src/index.ts`
(node:45749) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Server running on port http://localhost:8080/
MongoServerError: bad auth : authentication failed
    at Connection.onMessage (/home/felix/coding-projects/users-expressjs-api/node_modules/mongodb/src/cmap/connection.ts:409:18)
    at MessageStream.<anonymous> (/home/felix/coding-projects/users-expressjs-api/node_modules/mongodb/src/cmap/connection.ts:239:56)
    at MessageStream.emit (node:events:515:28)
    at MessageStream.emit (node:domain:488:12)
    at processIncomingData (/home/felix/coding-projects/users-expressjs-api/node_modules/mongodb/src/cmap/message_stream.ts:193:12)
    at MessageStream._write (/home/felix/coding-projects/users-expressjs-api/node_modules/mongodb/src/cmap/message_stream.ts:74:5)
    at writeOrBuffer (node:internal/streams/writable:556:12)
    at _write (node:internal/streams/writable:490:10)
    at MessageStream.Writable.write (node:internal/streams/writable:494:10)
    at TLSSocket.ondata (node:internal/streams/readable:985:22) {
  ok: 0,
  code: 8000,
  codeName: 'AtlasError',
  connectionGeneration: 0,
  [Symbol(errorLabels)]: Set(2) { 'HandshakeError', 'ResetPool' }
}
/home/felix/coding-projects/users-expressjs-api/node_modules/mongodb/src/cmap/connection.ts:409
        callback(new MongoServerError(document));
                 ^
MongoServerError: bad auth : authentication failed
    at Connection.onMessage (/home/felix/coding-projects/users-expressjs-api/node_modules/mongodb/src/cmap/connection.ts:409:18)
    at MessageStream.<anonymous> (/home/felix/coding-projects/users-expressjs-api/node_modules/mongodb/src/cmap/connection.ts:239:56)
    at MessageStream.emit (node:events:515:28)
    at MessageStream.emit (node:domain:488:12)
    at processIncomingData (/home/felix/coding-projects/users-expressjs-api/node_modules/mongodb/src/cmap/message_stream.ts:193:12)
    at MessageStream._write (/home/felix/coding-projects/users-expressjs-api/node_modules/mongodb/src/cmap/message_stream.ts:74:5)
    at writeOrBuffer (node:internal/streams/writable:556:12)
    at _write (node:internal/streams/writable:490:10)
    at MessageStream.Writable.write (node:internal/streams/writable:494:10)
    at TLSSocket.ondata (node:internal/streams/readable:985:22) {
  ok: 0,
  code: 8000,
  codeName: 'AtlasError',
  connectionGeneration: 0,
  [Symbol(errorLabels)]: Set(2) { 'HandshakeError', 'ResetPool' }
}
[nodemon] app crashed - waiting for file changes before starting...

The error implies you have the wrong username/password combination in your connection string.

1 Like

Well, I could read that error but still kept doubting a password error could be the issue. Turns out I didn’t terminate and delete before creating additional ‘Cluster 0’s’'. Did that, renamed a new cluster, simplified the password, turns out I have a saving problem with the auto-generated ones. Worked like a cham!! Thanks

1 Like