Custom error page getInitialProps and render called even when there is no error #12133
-
I'm not sure if I understand how custom The way I think it's supposed to work is that if (and only if) an error is thrown in the application, it should render the What I'm not getting is that when I have a custom
It calls both the I doubt this is a bug in Next.js (it's rather a bug in my mental model 😃) but I can't wrap my head around how it works right now :) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I assume you don't have a pages/404.js and it's being rendered for a 404 page. If your page does not have a favicon.ico the browser automatically tries to load it and that would result in the server rendering the 404/error page depending on which you have (We recommend adding pages/404.js if you have pages/_error.js though) |
Beta Was this translation helpful? Give feedback.
I assume you don't have a pages/404.js and it's being rendered for a 404 page. If your page does not have a favicon.ico the browser automatically tries to load it and that would result in the server rendering the 404/error page depending on which you have (We recommend adding pages/404.js if you have pages/_error.js though)