This is my first Next JS – MongoDB Project, so everything works fine on my localhost. After I deployed my website on Vercel, I got 500: Internal Server Error on several routes (I think it’s only the ones that have their data filled from the database), I double-checked my environment variables and everything was fine so I’m guessing this error has to do with "getServerSideProps", I’ve seen similar questions online. Still, I didn’t find any helpful solutions.
Here’s my code on GitHub: https://github.com/MoeElItani/Click-N-Eat
and my deployed website: https://click-n-eat.vercel.app/
2
Answers
Thanks to @juliomalves I checked my Function Logs and I found out the problem was that I was getting my data from localhost:3000/api/...
Changed to:
If you’re using mongodb atlas cluster, whitelist your ip. Change to 0.0.0.0. This will allow access database from anywhere.