Nodejs connect to mongoose failed on server(ubuntu 20.04), but worked on local

Hi, I am able to connect my node.js app via MongoDB url provided by mongodb.com. But in the server(ubuntu 20.04), it,s not connecting.
I am sure the database URL is accurate on the server. Also the server ip is whitelisted in Mongodb.com.

Hi @Mohammod_Shuvo,

Welcome to the MongoDB Community!

Could you please clarify how you were able to connect earlier (e.g., were you using a different operating system or a Virtual Machine), and if anything changed after which the issue started occurring?

Have you tested your Atlas connection string using mongo shell? If so, was it successful?

However, the error message is referring to the IP whitelisting issue. Could you please ensure that your current IP address is whitelisted on your MongoDB Atlas dashboard’s network access tab? Also, make sure it says (includes your current IP address).

If the issue still persists after verifying the above, feel free to reach out to us.

Regards,
Kushagra