Our setup is using Heroku as our web servers with static IPs that are whitelisted on our cluster, which is on AWS EC2 (Centos 8). The connection works and the application works (most of the time). However, the problem is that we have lots of disconnections we see in our logs (we have this in our connection code - mongoose):
"Error receiving request from client. Ending connection from remote","attr":{"error":{"code":141,"codeName":"SSLHandshakeFailed","errmsg":"The server is configured to only allow SSL connections"
Versions:
mongoose 6.2.0
mongo 5.0.6
NodeJS 18
I can run mongosh commands etc… as needed, but I’m wondering if anyone has an idea or direction I can investigate? I thought it might relate to Cloudflare being in the middle, but the Mongo URIs aren’t listed in there.
Based on the shared details, it appears that you have more than one server in your setup. Could you please confirm it?
To better understand the issue, could you provide more details about the frequency or percentage of occurrences when the disconnections happen?
The error message you shared suggests an SSL handshake failure, indicating that some of the web servers are not using TLS. To ensure that your web servers are using TLS, make sure to set the ssl option to true in the mongoose.connect() function or in your connection string. Additionally, it would be helpful to know if any recent changes were made, such as modifications in code or any differences in server configurations.
If you suspect any possible factors contributing to the issue, please let us know.
Yes, our cluster comprised of 3 servers, the primary is where we see almost all of the disconnections from (99%).
Regarding frequency: We can see disconnections happen about ~12 times an hour on average.
tls option is set to true. However, I will try to deploy with the ssl=true.
There weren’t any changes that caused this, it’s simply a new environment which is in the EU wheres we have another one in the US with the exact same configurations.