sentry-javascript icon indicating copy to clipboard operation
sentry-javascript copied to clipboard

ErrorBoundary not workling on remix integration

Open sbolanosQB opened this issue 1 year ago • 3 comments

Is there an existing issue for this?

  • [X] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
  • [X] I have reviewed the documentation https://docs.sentry.io/
  • [X] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/remix

SDK Version

8.5.0

Framework Version

18.2.0

Link to Sentry event

No response

SDK Setup

No response

Steps to Reproduce

export const ErrorBoundary = () => {
  const error = useRouteError();

  captureRemixErrorBoundaryError(error);

  return <QbNavErrorPage />;
};

export default withSentry(App, {
  wrapWithErrorBoundary: true,
  errorBoundaryOptions: { fallback: ErrorBoundary },
});

Expected Result

an automatic rerouting when an error is thrown

Actual Result

Nothing

sbolanosQB avatar May 28 '24 10:05 sbolanosQB

I think using the Remix error boundary as a fallback is not how this option is intended to be used. I'd set wrapWithErrorBoundary: false, and then wrap your react components with ErrorBoundary accordingly.

AbhiPrasad avatar May 28 '24 14:05 AbhiPrasad

I think using the Remix error boundary as a fallback is not how this option is intended to be used. I'd set wrapWithErrorBoundary: false, and then wrap your react components with ErrorBoundary accordingly.

Hi, thanks for the quick answer. then wrap your react components with ErrorBoundary accordingly this is unclear to me, can you post a small example?

sbolanosQB avatar May 29 '24 08:05 sbolanosQB

I think you can just leave the export of the error boundary. Here's an example from our e2e tests: https://github.com/getsentry/sentry-javascript/blob/develop/dev-packages/e2e-tests/test-applications/create-remix-app-v2/app/root.tsx

AbhiPrasad avatar May 29 '24 18:05 AbhiPrasad

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

getsantry[bot] avatar Jul 02 '24 07:07 getsantry[bot]