Looking at the error stack trace, it appears that the application is encountering difficulties establishing a connection to your MongoDB Serverless Instance. This could be due to likely issues with IP whitelisting or a VPC peering problem.
To further understand, could you please provide additional information? Specifically, details on whether this issue is intermittent or persistent, any recent changes made to your network settings, and the workflow you followed. Additionally, please provide version details of Mongoose and MongoDB.
It doesn’t seem like IP problem because it does connect and works fine but at times it gives this error. I have allowed all IP using 0.0.0.0/0. The mongoose version is 7.4 . Waiting for your response any help is appreciated