I keep getting error when i try connecting node to mongodb

App is listening on port 5001

/Users/olumayokunogunfowora/Desktop/complete-node-bootcamp-master/4-natours/starter/node_modules/mongoose/node_modules/mongodb/lib/cmap/connect.js:367
            return new error_1.MongoNetworkError(err);
                   ^

MongoNetworkError: 80203CF601000000:error:0A000438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error:../deps/openssl/openssl/ssl/record/rec_layer_s3.c:1586:SSL alert number 80

    at connectionFailureError (/Users/olumayokunogunfowora/Desktop/complete-node-bootcamp-master/4-natours/starter/node_modules/mongoose/node_modules/mongodb/lib/cmap/connect.js:367:20)
    at TLSSocket.<anonymous> (/Users/olumayokunogunfowora/Desktop/complete-node-bootcamp-master/4-natours/starter/node_modules/mongoose/node_modules/mongodb/lib/cmap/connect.js:290:22)
    at Object.onceWrapper (node:events:628:26)
    at TLSSocket.emit (node:events:513: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: 80203CF601000000:error:0A000438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error:../deps/openssl/openssl/ssl/record/rec_layer_s3.c:1586:SSL alert number 80
  ] {
    library: 'SSL routines',
    reason: 'tlsv1 alert internal error',
    code: 'ERR_SSL_TLSV1_ALERT_INTERNAL_ERROR'
  },
  connectionGeneration: 1,
  [Symbol(errorLabels)]: Set(1) { 'ResetPool' }
}

Node.js v18.16.1
[nodemon] app crashed - waiting for file changes before starting...

Good afternoon, welcome!

You can pass information about your connection, how you are creating, if you are using Atlas or your own servers. This will help people understand the problem.

One possible cause to this for Mongo Atlas in particular, is if your IP is not whitelisted. In that case, the SSL handshake fails. The error is a little misleading, but I was getting an “ERR_SSL_TLSV1_ALERT_INTERNAL_ERROR” until I whitelisted my IP address.

1 Like

Yeah Thanks,It really helped me