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

Support Remix v2 #7810

Closed
AbhiPrasad opened this issue Apr 11, 2023 · 5 comments
Closed

Support Remix v2 #7810

AbhiPrasad opened this issue Apr 11, 2023 · 5 comments
Assignees
Labels
Package: remix Issues related to the Sentry Remix SDK

Comments

@AbhiPrasad
Copy link
Member

AbhiPrasad commented Apr 11, 2023

https://remix.run/docs/en/main/pages/v2

Coming soon - let's make sure our SDK can work with it!

Tasks

@onurtemizkan
Copy link
Collaborator

onurtemizkan commented Jun 6, 2023

Made a mini research on what needs to be done to support Remix v2, looking at their pre-release document.

File System Route Convention

Not likely to affect us, as we are instrumenting routes by iterating the server build, instead of following folder structures, filenames.
Will still need to check if anything inside the server build folder changed.

Route meta

We use this API not just for monkey-patching. We also use and patch it to inject sentry-trace and baggage headers.

Looks like both the API and the route behaviour will change here. 👇

In addition, will no longer render meta for every route in the hierarchy. Only data returned from meta in the leaf route will be rendered. You can still choose to include meta from the parent route by accessing matches in the function's arguments.

Will need to come up with a new solution here, as we were using the previous behaviour to inject sentry-trace and baggage headers.

Update: I just tested it with the v2_meta feature flag, and it's working fine with our current SDK.

CatchBoundary and ErrorBoundary

In v1, a thrown Response will render the closest CatchBoundary while all other unhandled exceptions render the ErrorBoundary. In v2 there is no CatchBoundary and all unhandled exceptions will render the ErrorBoundary, response or otherwise.

Wrapping those to get client-side errors reported (also fallback screened) consistently is already discussed at #5762. Remix merging CatchBoundary and ErrorBoundary will probably make it easier.

Additionally, the error is no longer passed to ErrorBoundary as props but is accessed with the useRouteError hook.

We should also look at how to instrument the new useRouteError hook.

We can stop auto-wrapping root component with @sentry/react's ErrorBoundary, and instrument Remix's ErrorBoundary instead. This way we will report any error that Remix considers an error.

This will require some changes in usage, making client-side error-tracking opt-in. See: #5762 (comment)

serverModuleFormat

The default server module output format will be changing from cjs to esm.

We may also need to investigate whether this will create any issues during server-side auto-instrumentation.

@dmarkow
Copy link

dmarkow commented Jun 6, 2023

v1.17.0 (released today) has some new features for dealing with server-side errors that may be useful to integrate as well.

@AbhiPrasad
Copy link
Member Author

AbhiPrasad commented Jun 15, 2023

We'll have to make sure we work with the Remix's future flags: https://remix.run/docs/en/main/pages/api-development-strategy

@huw
Copy link

huw commented Jul 30, 2023

Just FYI the current solution will fail once Remix actually release v2, because the future flags will be deleted. I am not aware of a way to test for v2 or not; you might be able to check for other API changes. This is somewhat urgent because v2 will be the next release.

@AbhiPrasad
Copy link
Member Author

@huw, thanks for the heads up! Created #8681 to track this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: remix Issues related to the Sentry Remix SDK
Projects
Archived in project
Development

No branches or pull requests

5 participants