#Use of withErrorBondary(App, {...}) in Next.js?

2 messages · Page 1 of 1 (latest)

tribal kraken
#

Hello,
I'm currently working to upgrade out sentry set up from a somewhat outdated format. I was not part of the initial set up so am a bit unclear about the details. We are running on NextJS with page routing, v. 12.3.4 and sentry/nextjs v.7.80.1.

Following sentry's offical Next.js documentation I reworked our _error.tsx page to function similarily to the example. It seemed to be reporting as normal after a yarn build and yarn start.

Now I've encountered an issue due to the way the _error page has been rewritten. Inn our _app.tsx file we have the following function:

export default withErrorBoundary(App, {
fallback: (
<ErrorPage with some props />
)
})

This is now throwing errors due to props no longer existing on the ErrorPage component (part of the _error.tsx rewrite).

So far as I can tell, this function is unnecessary at best or a mistake to implement at worst. The Next.js documentation does not mention it, only the pure React documentation does. Would I be wrong in simply deleting this function? Errors (at least page not found) are still getting through after commenting out the function.

tough citrus
#

hey I believe if you use an error boundary i believe it interferes with Sentry's error capturing. I think you would have to call captureException within the boundary to send errors. Otherwise, the default nextjs setup from the wizard does not use error boundaries