"connection * to *:27017 closed" error

Hello everyone,
I encounter this error every 3 or 4 days. My project runs on app engine and on average around 500 thousand queries and transactions are made daily and all of it works with Mongodb but in the future, this rate will reach 5 million requests per day, but this is not limited to 5 million, it will increase even more. My app engine settings are set to scale completely automatically. There is a serverless production in Mongodb Atlas.

This is how my Nodejs project connects to mongodb atlas.

The only network access IP address in MongoDB Atlas:

Nodejs Version: 18

And I get this error “MongoNetworkError: read ECONNRESET” 1 or 2 times a month.

How can I solve this problem?

@Mete_Oguzhan_Bayrampinar, based on the details you’ve share I’m not entirely sure what you’re describing is actually an issue. Though a MongoNetworkError bubbling up to the application is indicative of an error, the MongoDB drivers have retryability features built in to account for these transient network issues (such as retryable reads and retryable writes).

When you see this error in the logs is it associated with a failed operation by the application? Is data not being read/written?

And I get this error “MongoNetworkError: read ECONNRESET” 1 or 2 times a month.

That’s pretty infrequent given the volume of traffic you’re alluding to, but if you really want to go into the weeds node.js - How to debug a socket hang up error in NodeJS? - Stack Overflow has some details that might be interesting.