Internal server error(500) #80405
Replies: 2 comments 14 replies
-
Wrap the internals of GSSP in a try catch: try {
const { "token.dev": token } = parseCookies(ctx);
if (!token) {
return {
redirect: {
destination: "/logout",
permanent: false,
},
};
}
const loggedUser = await recoverUserInformation(token);
const userExists = loggedUser ? true : false;
const isStaff = loggedUser
? loggedUser.isStaff
? loggedUser.isStaff
: false
: false;
if (userExists === false || isStaff === false) {
return {
redirect: {
destination: "/logout",
permanent: false,
},
};
}
return {
props: {},
};
} catch(reason) {
console.log(reason instanceof Error ? reason.message : reason)
return { props: {} }
} Something like that, let's make sure that our own code is not misbehaving in production, through some edge case. |
Beta Was this translation helpful? Give feedback.
-
It sounds like your Billing page runs fine locally but throws a 500 error only on Vercel, which suggests a runtime issue during getServerSideProps or the initial render that isn't surfacing in local dev. Here are some suggestions and possible causes to help narrow it down:
This usually gives the exact error stack trace, such as:
Check this guide if not already done: |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
I have a project, it runs smoothly on my machine without any problems, I hosted it on Vercel, and when I try to access a page it returns error 500, but on my machine it runs smoothly, I use the same structure for all pages, but it only gives an error on this one, I suspect it may be a problem with Vercel, I don't do that, I'll leave the code snippet. Help me pls
Additional information
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions