hoangvvo / nextjs-mongodb-app

A Next.js and MongoDB web application, designed with simplicity for learning and real-world applicability in mind.
https://nextjs-mongodb.now.sh/
MIT License
1.54k stars 289 forks source link

Problem with the api/user #141

Open Vinzouz opened 2 years ago

Vinzouz commented 2 years ago

Hi, I'm creating my Nextjs application which uses MongoDB Atlas, your project helped me a lot to understand how everything works so already thanks a lot!

Everything works perfectly locally and on Vercel but when I try to put it online on a server (cPanel) I always get this error from the api/user: "connect ECONNREFUSED 3.67.190.44:27017". And this in the logs: "at Timeout._onTimeout (/home/.../14/lib/node_modules/mongodb/lib/sdam/topology.js:312:38)". I've been searching a lot for the past few days but I have no idea where this is coming from.

Do you have any idea? Thanks in advance.

hoangvvo commented 2 years ago

It appears that the API cannot connect to your MongoDB database. Make sure the database is set up correctly and open to access from outside.