Skip to content

Commit 27b63af

Browse files
authored
docs(js): Add alert on auto-instrumentation for react-router framework (#13929)
1 parent 3a1cb70 commit 27b63af

File tree

1 file changed

+38
-0
lines changed
  • docs/platforms/javascript/guides/react-router

1 file changed

+38
-0
lines changed

docs/platforms/javascript/guides/react-router/index.mdx

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,44 @@ export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) {
172172

173173
### Server-Side Setup
174174

175+
<Expandable level="warning" title="Limited Node support for auto instrumentation" permalink>
176+
Automatic server-side instrumentation is currently only supported on:
177+
- **Node 20:** Version \<20.19
178+
- **Node 22:** Version \<22.12
179+
180+
181+
If you are on a different version please make use of our manual server wrappers.
182+
183+
For server loaders use `wrapServerLoader`:
184+
```ts
185+
import * as Sentry from '@sentry/react-router';
186+
187+
export const loader = Sentry.wrapServerLoader(
188+
{
189+
name: 'Load Some Data',
190+
description: 'Loads some data from the db',
191+
},
192+
async ({ params }) => {
193+
// ... your loader logic
194+
}
195+
);
196+
```
197+
For server actions use `wrapServerAction`:
198+
```ts
199+
import * as Sentry from '@sentry/react-router';
200+
201+
export const action = Sentry.wrapServerAction(
202+
{
203+
name: 'Submit Form Data',
204+
description: 'Processes form submission data',
205+
},
206+
async ({ request }) => {
207+
// ... your action logic
208+
}
209+
);
210+
```
211+
</Expandable>
212+
175213
Create an `instrument.server.mjs` file in the root of your app:
176214

177215
```js {filename: instrument.server.mjs}

0 commit comments

Comments
 (0)