Not sure why you aren’t connecting either. As I said, I clone the repo and tested your code and it works for me. I also get that exact same error message if I use the wrong name or password or remove the IP whitelist.
I would suggest you log out process.env.DB_URI and make sure you are getting the value and triple-check you have the correct name/password. If that doesn’t work I would check that you are not blocking the connection locally (firewall). If you use something like TCPView you should see a node process with connections.
Well, I just meant logging out the variable to make sure you were getting it correctly. But hardcoding the connection string works as well. On the Database Access tab did you try clicking the edit button and checking the password?
You won’t see a connection in TCPView because you are not connected. You would see a node.exe process with some connections.
Edit: I missed this. That would confirm it to be a local issue. Maybe your router is blocking it? With the same code working on Replit I don’t really know what else can cause it, except the connection being blocked somehow.
If you have MongoDB installed locally as well try the code with a local DB. If that works it must be the connection.
If it is not the connection directly being blocked it might be the DNS being blocked. You can try using another DNS provider to test this. And as I said, if you are behind a router it can have firewall settings as well.