Getaddrinfo EAI_AGAIN


I’m using MongoDB Serverless with for my Node.js hosted on a lightsail server. Rarely like once in a week or two, I find errors in the logs which look like this
getaddrinfo EAI_AGAIN
Looks like the connection to the db has been lost, I’ve been tackling w this issue for a while now, so I added listeners on disconnect and error events to try to reconnect in 2secs, but I can see it wasn’t of much help as its the same error for another 10 tries and eventually the server crashes.
Restarting the server and everything works pretty smooth again