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

[JavaScript] React Router (v7) SDK #14519

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

[JavaScript] React Router (v7) SDK #14519

chargome opened this issue Nov 28, 2024 · 19 comments
Assignees
Labels
Package: react-router Issues related to the Sentry React Router SDK

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.

@getsantry getsantry bot removed the status in GitHub Issues with 👀 3 Feb 3, 2025
@MatteoGauthier
Copy link

@chargome I'm refering to this section of the RR7 Framework Mode docs : https://docs.sentry.io/platforms/javascript/guides/react-router/#server-side-setup

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

chargome commented Feb 3, 2025

@MatteoGauthier could you give me an example of your RR setup?

it's possible to create a build just for the client

Basically what are you referring to with this

@MatteoGauthier
Copy link

@chargome No special implementation, just the default starter of RR7 looks like this https://github.com/remix-run/react-router-templates/tree/main/default

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

Is there anyone who made this work? I tried it with the Documentation https://docs.sentry.io/platforms/javascript/guides/react-router/ but for me it wont work - i cant use any --import stuff in my package.json cause im using ~ paths - i get an error when i do - before i didnt need such stuff with remix. My Problem is atm im paying for no reason...

@chargome
Copy link
Member Author

chargome commented Feb 3, 2025

@MatteoGauthier with this setup your pages are being rendered on the server so should just be fine with the setup from the docs.

@intsanerarity could you open a separate issue where you explain your issue in detail?

We're working on releasing an alpha version for this package within the next two weeks!

@intsanerarity
Copy link

to explain it very fast.

if i create your instrument.server.mjs and i need to start up my react router app with --NODE-OPTIONS it breaks my whole application cause the "~" as my import alias is not working anymore.

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

chargome commented Feb 3, 2025

@intsanerarity could you provide a reproduction?

@dyeoman2
Copy link

dyeoman2 commented Feb 3, 2025

Is there anyone who made this work? I tried it with the Documentation https://docs.sentry.io/platforms/javascript/guides/react-router/ but for me it wont work - i cant use any --import stuff in my package.json cause im using ~ paths - i get an error when i do - before i didnt need such stuff with remix. My Problem is atm im paying for no reason...

Check out the Epic Stack https://github.com/epicweb-dev/epic-stack

@intsanerarity
Copy link

Is there anyone who made this work? I tried it with the Documentation https://docs.sentry.io/platforms/javascript/guides/react-router/ but for me it wont work - i cant use any --import stuff in my package.json cause im using ~ paths - i get an error when i do - before i didnt need such stuff with remix. My Problem is atm im paying for no reason...

Check out the Epic Stack https://github.com/epicweb-dev/epic-stack

thanks for this hint man! It worked!!! Finally Sentry again thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: react-router Issues related to the Sentry React Router SDK
Projects
Status: No status
Development

No branches or pull requests

10 participants