You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have this NextJS 14 application using the App router in standalone output mode.
It has a global-error boundary with some UI and text for whenever the app fails, however this is not used when there is an infrastructure issue, like nginx timing out due to the internal services being unavailable, and then showing an upstream error.
I understand that in this case, the NextJS app is not even obtained by the server, hence the raw text response for the error.
I am trying to create a config in the infrastructure that will use a static HTML file instead of the raw response.
My issue is figuring out how I can obtain a static HTML export of the NextJS error boundary during build time, so that I can copy it somewhere else (Like S3), and then use that for the infrastructure errors. (This is important so that it keeps up to date)
I am not sure how can that be achieved while maintaining the standalone mode.
Right now I have a page defined that renders the global error component:
But after the build it generates a page.js, which is obviously not what I want.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
I have this NextJS 14 application using the App router in standalone output mode.
It has a global-error boundary with some UI and text for whenever the app fails, however this is not used when there is an infrastructure issue, like nginx timing out due to the internal services being unavailable, and then showing an upstream error.
I understand that in this case, the NextJS app is not even obtained by the server, hence the raw text response for the error.
I am trying to create a config in the infrastructure that will use a static HTML file instead of the raw response.
My issue is figuring out how I can obtain a static HTML export of the NextJS error boundary during build time, so that I can copy it somewhere else (Like S3), and then use that for the infrastructure errors. (This is important so that it keeps up to date)
I am not sure how can that be achieved while maintaining the standalone mode.
Right now I have a page defined that renders the global error component:
But after the build it generates a page.js, which is obviously not what I want.
Help is appreciated. Thank you.
Additional information
No response
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions