Skip to content

[JavaScript] React Router (v7) SDK #14519

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

Open
chargome opened this issue Nov 28, 2024 · 36 comments
Open

[JavaScript] React Router (v7) SDK #14519

chargome opened this issue Nov 28, 2024 · 36 comments

Comments

@chargome
Copy link
Member

chargome commented Nov 28, 2024

Description

This ticket is about supporting React Router v7 as a full meta-framework: https://reactrouter.com/start/framework/installation

This includes full instrumentation for both client and server side.

Overview

We will publish a new package @sentry/react-router.
To not carry over too much unneeded functionality like rsbuild support, non-otel instrumentation or support for older remix versions we will not build upon @sentry/remix and rather treat this as new SDK with the possibility of re-using remix otel instrumentation.

The starting point will be instrumenting the framework using @sentry/node and @sentry/react

Discussed approach for configuration and entrypoints:

  • Create a Vite plugin for react router
  • Create a wrapper for the react router config file for having access to all config params
  • Create separate instrumentation files for client and server, which can be imported in the respective entry files (esm support possible)
  • (Possibly) create a wrapper for the new routes.ts file
  • we still need to check at which point this file is evaluated and if this will help us with parameterization
  • for future compatibility this might be a good file to have from the start on

Additional tasks (issue creation tbd)

  • Write a migration path from @sentry/remix to @sentry/react-router
  • Wizard for @sentry/react-router
@intsanerarity
Copy link

hey,

im coming from Remix - used @sentry/remix before, but after upgrading to RRv7 there are dependencies which cant be there "react-router-dom" from some remix packages - so would be nice, if the new implementation will also work from former @sentry/remix users.

BR
Steven

@AbhiPrasad
Copy link
Member

This probably needs to be a new package, and we also need to write out migration docs about how to go from @sentry/remix to @sentry/react-router.

@punkpeye

This comment has been minimized.

@AlemTuzlak
Copy link

Anything I can do to help you guys?

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Dec 9, 2024
@chargome
Copy link
Member Author

@AlemTuzlak Not yet, we'll refine this ticket as soon as possible and provide a more detailed roadmap.

@AbhiPrasad AbhiPrasad added the Package: react-router Issues related to the Sentry React Router SDK label Dec 17, 2024
@chargome chargome self-assigned this Dec 18, 2024
@chargome chargome changed the title Support React Router v7 (framework) [JavaScript] Support React Router v7 (framework) Dec 18, 2024
@willhoney7
Copy link

For others finding this before the full v7 framework support is available, here's the guide on how to get it working with the react and node integrations: https://docs.sentry.io/platforms/javascript/guides/react-router/. It was a bit hard for me to find, so sharing here.

@denissisic
Copy link

Hey @denissisic, thanks for reaching out! You probably missed the part of exposing your hooks with npx react-router reveal – after this you should be able to see these files and wrap handleRequest in entry.server.tsx

Hi @chargome! I haven't miss revealing. What I meant is that RR7 Framework doesn't use those files (like Remix does).
Even after I added those files (for Sentry), the code from documentation didn't work.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Apr 15, 2025
@AlemTuzlak
Copy link

@denissisic yes it does, and they can be revealed, by default they use the internal default entry.client and entry.server files which you can reveal if you need to make changes to them.

@AlemTuzlak
Copy link

At least the framework mode of react-router v7, library indeed doesn't

@chargome
Copy link
Member Author

@denissisic the framework does use these files: https://reactrouter.com/explanation/special-files#entryservertsx

Would you mind creating a separate issue with a reproduction so we can investigate what is causing the problem?

@stephanie-anderson stephanie-anderson removed the Package: react-router Issues related to the Sentry React Router SDK label Apr 16, 2025
@denissisic
Copy link

@denissisic the framework does use these files: https://reactrouter.com/explanation/special-files#entryservertsx

Would you mind creating a separate issue with a reproduction so we can investigate what is causing the problem?

Hey guys! Sorry for jumping to wrong conclusions due to misunderstanding on my part. It seems that all works now.

@NGimbal
Copy link

NGimbal commented Apr 16, 2025

Hey @NGimbal! Would you mind creating a separate issue for this where you share your SDK setup? This would help us a lot to pin down your problem.

New issue here #16086 🙏

@gijsroge
Copy link

gijsroge commented Apr 19, 2025

@chargome I saw @mydea removed many of the instrumentation todo's from the milestone what does this mean for the stable SDK release?

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Apr 19, 2025
@chargome
Copy link
Member Author

@gijsroge that was just some internal restructuring, we're still actively working towards a stable release atm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests