next.jsprismanext-auth

Application error: a server-side exception has occurred next.js


I tried to deploy my nextjs application to vercel. This project is built using Prisma and Nextauth. The deployement went well, however when I go the url of my project it shows this error: Application error: a server-side exception has occurred (see the server logs for more information). The error in my console is this Error: An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error..

When I tried the npm run build command it worked well locally, and the only place where it doesn't work is the vercel deployment. Any help is appreciated.


Solution

  • I fixed this problem by doing many things, but if someone is still struggling with this problem, I would suggest you manually run npx prisma generate before deploying, check the environment variables and add them to Vercel Environment Variables. The problem with my code was with prisma and nothing with next-auth and I was able to find it with removing all of the prisma related code. If using mongodb make sure to add the correct IP address