Skip to content

docs(js): Add alert on auto-instrumentation for react-router framework #13929

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

Merged
merged 1 commit into from
Jun 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions docs/platforms/javascript/guides/react-router/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,44 @@ export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) {

### Server-Side Setup

<Expandable level="warning" title="Limited Node support for auto instrumentation" permalink>
Automatic server-side instrumentation is currently only supported on:
- **Node 20:** Version \<20.19
- **Node 22:** Version \<22.12


If you are on a different version please make use of our manual server wrappers.

For server loaders use `wrapServerLoader`:
```ts
import * as Sentry from '@sentry/react-router';

export const loader = Sentry.wrapServerLoader(
{
name: 'Load Some Data',
description: 'Loads some data from the db',
},
async ({ params }) => {
// ... your loader logic
}
);
```
For server actions use `wrapServerAction`:
```ts
import * as Sentry from '@sentry/react-router';

export const action = Sentry.wrapServerAction(
{
name: 'Submit Form Data',
description: 'Processes form submission data',
},
async ({ request }) => {
// ... your action logic
}
);
```
</Expandable>

Create an `instrument.server.mjs` file in the root of your app:

```js {filename: instrument.server.mjs}
Expand Down
Loading