Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ref(remix): Rework Error Handling #9725

Merged
merged 6 commits into from
Dec 5, 2023

Conversation

onurtemizkan
Copy link
Collaborator

@onurtemizkan onurtemizkan commented Dec 2, 2023

Resolves: #9695
Should also resolve: #9563

Rewrote the error reporting logic of Remix SDK to handle inconsistencies, missing stack traces and potential duplications.

There are 5 main error types that we are concerned.

  • Runtime Browser errors
  • SSR Rendering errors
  • Errors thrown in loaders and actions
  • Error Responses
  • Unexpected server-side errors

And there are different points we can capture such as:

  • handleError,
  • action / loader / documentRequest instrumentation
  • ErrorBoundary

An error is not guaranteed to end up only one of those utilities. Also the objects for the same error are not guaranteed to be the same in different places. That causes duplications.

So, with this patch, the new error handling / filtering logic for the instrumentation will be as below:

handleError loader/action Instrumentation documentRequest Instrumentation Remix v2 ErrorBoundary @sentry/react ErrorBoundary
Runtime Browser Error - - - v2 v1
SSR Rendering Error v2 - v1 - -
loader / action Errors v2 v1 - - -
Error Responses / Thrown Responses - v1 / v2 - - -
Unexpected Server-side Errors v2 v1 - - -

This PR also adds:

  • Sentry.wrapRemixHandleError to be assigned as handleError for entry.server (Needs docs / wizard support)
  • New tests for SSR error capturing.

Copy link
Contributor

github-actions bot commented Dec 2, 2023

size-limit report 📦

Path Size
@sentry/browser (incl. Tracing, Replay) - Webpack (gzipped) 65.99 KB (+0.19% 🔺)
@sentry/browser (incl. Tracing, Replay) - Webpack with treeshaking flags (gzipped) 59.59 KB (+0.22% 🔺)
@sentry/browser (incl. Tracing) - Webpack (gzipped) 31.12 KB (0%)
@sentry/browser - Webpack (gzipped) 21.38 KB (-0.01% 🔽)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (gzipped) 62.97 KB (+0.41% 🔺)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (gzipped) 29.62 KB (+0.33% 🔺)
@sentry/browser - ES6 CDN Bundle (gzipped) 21.7 KB (+0.46% 🔺)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (minified & uncompressed) 198.31 KB (+0.44% 🔺)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (minified & uncompressed) 89.73 KB (+0.47% 🔺)
@sentry/browser - ES6 CDN Bundle (minified & uncompressed) 64.71 KB (+0.66% 🔺)
@sentry/browser (incl. Tracing) - ES5 CDN Bundle (gzipped) 32.29 KB (+0.22% 🔺)
@sentry/react (incl. Tracing, Replay) - Webpack (gzipped) 66.35 KB (+0.16% 🔺)
@sentry/react - Webpack (gzipped) 21.42 KB (0%)
@sentry/nextjs Client (incl. Tracing, Replay) - Webpack (gzipped) 83.07 KB (+0.14% 🔺)
@sentry/nextjs Client - Webpack (gzipped) 48.21 KB (-0.01% 🔽)
@sentry-internal/feedback - Webpack (gzipped) 16.17 KB (-0.13% 🔽)
@sentry/browser (incl. Tracing, Replay, Feedback) - Webpack (gzipped) 74.63 KB (added)
@sentry/browser (incl. Feedback) - Webpack (gzipped) 29.72 KB (added)
@sentry/browser (incl. Tracing, Replay, Feedback) - ES6 CDN Bundle (gzipped) 71.22 KB (added)

@onurtemizkan onurtemizkan force-pushed the onur/remix-captureRemixServerException-rework branch 6 times, most recently from 1155a1b to 1f076b6 Compare December 4, 2023 13:31
@onurtemizkan onurtemizkan force-pushed the onur/remix-captureRemixServerException-rework branch from 1f076b6 to 453d1c4 Compare December 5, 2023 11:35
@onurtemizkan onurtemizkan marked this pull request as ready for review December 5, 2023 11:35
@onurtemizkan onurtemizkan changed the title ref(remix): Rework captureRemixServerException ref(remix): Rework Error Handling Dec 5, 2023
Copy link
Member

@AbhiPrasad AbhiPrasad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks for these changes @onurtemizkan!

@AbhiPrasad AbhiPrasad merged commit 4044447 into develop Dec 5, 2023
59 checks passed
@AbhiPrasad AbhiPrasad deleted the onur/remix-captureRemixServerException-rework branch December 5, 2023 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants