Unable to connect to the database serverless instance from the Amazon EC2 server machine

I’ve launched an EC2 instance with Elastic Beanstalk service, but the database connection is failing due to the below error.

The error details are as follows:

Apr 14 13:20:25: > testbackend@1.0.0 start
Apr 14 13:20:25: > node -r dotenv/config --experimental-json-modules index.js
Apr 14 13:20:26: MongoDB Server connection failed MongoNetworkError: 000E4459507F0000:error:0A000438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error:ssl/record/rec_layer_s3.c:1605:SSL alert number 80
Apr 14 13:20:26:    at connectionFailureError (/var/app/current/node_modules/mongodb/lib/cmap/connect.js:379:20)
Apr 14 13:20:26:    at TLSSocket.<anonymous> (/var/app/current/node_modules/mongodb/lib/cmap/connect.js:285:22)
Apr 14 13:20:26:    at Object.onceWrapper (node:events:633:26)
Apr 14 13:20:26:    at TLSSocket.emit (node:events:518:28)
Apr 14 13:20:26:    at emitErrorNT (node:internal/streams/destroy:169:8)
Apr 14 13:20:26:    at emitErrorCloseNT (node:internal/streams/destroy:128:3)
Apr 14 13:20:26:    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
Apr 14 13:20:26:  connectionGeneration: 0,
Apr 14 13:20:26:  [Symbol(errorLabels)]: Set(0) {},
Apr 14 13:20:26:  [cause]: [Error: 000E4459507F0000:error:0A000438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error:ssl/record/rec_layer_s3.c:1605:SSL alert number 80
Apr 14 13:20:26:  ] {
Apr 14 13:20:26:    library: 'SSL routines',
Apr 14 13:20:26:    reason: 'tlsv1 alert internal error',
Apr 14 13:20:26:    code: 'ERR_SSL_TLSV1_ALERT_INTERNAL_ERROR'
Apr 14 13:20:26:  }
Apr 14 13:20:26: }

The normal solution for the above problem is IP address whitelisting, which should work. It is working in my local dev machine environment, but not working in the ec2 machine environment.

Please help me with the above problem guys.

I’ve seen some comments on stack exchange about node version or modules being out of date and needing updating …

It is working in my local dev machine environment, but not working in the ec2 machine environment.

I’m not sure that proves anything about what we’re talking about.

Okay, fine. Can you please tell me for which applicable cases the above ERROR is DESIGNED?

As Jack said, that error is commonly shown with whitelisting issues. Have you tried temporarily adding a generic whitelist to verify that it’s that causing the issue?
Any existing whitelist will be invalid if you’re changing the IP address you’re connecting from by swapping from a local setup to running on EC2.