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...
1 Like

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.

1 Like

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.

7 Likes

Yeah Thanks,It really helped me

2 Likes

Hey!
did you figure out the olutio i am getting the same erro.

Here

“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.”

2 Likes

Can you please guide me how to whitelist ip

Instructions are in the documentation:

When creating a deployment it should automatically add your current IP or at least give you the option.

In the security section you go to “Network Access” → “Add IP Address” then select any IP address

it helps me too so thank you for this post so other developer can take advantage of

1 Like

if you are using Any VPN or any shield like Macfree etc . off it from your settings and once try again. For me it worked.