error when deploy next js full stack to vercel

error when deploy next js full stack to vercel Hello I'm facing an issue when i make a fullstack application with next js when you use getServerSession() from NextAuth in server component or when you use mongodb and mongoose to fetch something from database the page takes so much time to load and he gives you this error when you deploy to vercel This Serverless Function has timed out. Your connection is working correctly. Vercel is working correctly. 504: GATEWAY_TIMEOUT Code: FUNCTION_INVOCATION_TIMEOUT do any one know the solution for this ?
5 Replies
EnderTheNetrunner
Uhhh where is this mongodb instance you're hosting it on?
webdevkaleem
webdevkaleem2mo ago
Any code reference would make things clearer
Amro_97
Amro_97OP2mo ago
GitHub
GitHub - amro22397/todo-fullstack
Contribute to amro22397/todo-fullstack development by creating an account on GitHub.
Amro_97
Amro_97OP2mo ago
this is the source code: https://github.com/amro22397/todo-fullstack go to app then page I test my code there there is no issue with getSession() but the issue with fetching data from mongoDB
GitHub
GitHub - amro22397/todo-fullstack
Contribute to amro22397/todo-fullstack development by creating an account on GitHub.
EnderTheNetrunner
Are you able to log out the specific error it has when getting to Mongo

Did you find this page helpful?