Uncaught 500 error from API route behavior? #15640
-
I don't quite understand how errors (other than 404) are handled. What is the expected behavior if an API route returns an uncaught 500 error? Should the default 500 error page be displayed? If not, what is an example of when the 500 error page should be displayed? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
500 errors for an API route would not display an HTML page, rather just a server HTTP status code of 500. As far as when the 500 error page would show, one example I can think of is if you have a page that uses export async function getServerSideProps(context) {
throw new Error("500 page will be shown")
} Basically any runtime error that happens on a page while running on the server (aka Node) would cause this to happen. |
Beta Was this translation helpful? Give feedback.
500 errors for an API route would not display an HTML page, rather just a server HTTP status code of 500.
As far as when the 500 error page would show, one example I can think of is if you have a page that uses
getServerSideProps
and that has an error in it.Basically any runtime error that happens on a page while running on the server (aka Node) would cause this to happen.