Getting 500 error when loading document page next.js vercel app after second load

Viewed 21

I have a next.js app hosted on vercel which keeps giving me a 500 error when trying to load one of my pages. From chrome dev tools I can see the error is originating when it tries to request the document page /dashboard. I know it's not a server error as my backend works fine in development and when using postman (locally and with the production api url). It just loads a blank page when the request returns a 500 error.

Something else which is strange: when you first load the page after clearing cache/just logging out, it'll load perfectly fine. However after the first refresh it returns a 500 error when trying to access the dashboard page.

When the 500 error is thrown, I can see from the network tab in dev tools that it isn't even getting to the point of sending requests to my backend.

The production url is here

Use the login credentials test@email.com Test_user1234!

After it should automatically route you to the /dashboard page, and it should load on the first request (be patient, first load is very slow). Then if you try and reload it'll throw the 500 error.

The requested data will be cached in localstorage.

1 Answers

Check if your db connected or not, make sure to make a global function for connection which connects to db automatically if db connection stops.

Related