Skip to content

Commit 61d570f

Browse files
Add onboarding wizard for Remix SDK (#5352)
Co-authored-by: Isabel <[email protected]>
1 parent 3356706 commit 61d570f

File tree

1 file changed

+88
-0
lines changed

1 file changed

+88
-0
lines changed

src/wizard/javascript/remix.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
---
2+
name: Remix
3+
doc_link: https://docs.sentry.io/platforms/javascript/guides/remix/
4+
support_level: production
5+
type: framework
6+
---
7+
8+
To instrument your Remix application with Sentry, first install the `@sentry/remix` package:
9+
10+
```bash
11+
# Using yarn
12+
yarn add @sentry/remix
13+
14+
# Using npm
15+
npm install --save @sentry/remix
16+
```
17+
18+
Next, import and initialize initialize Sentry in your Remix entry points for both the client and server:
19+
20+
```javascript
21+
import { useLocation, useMatches } from "@remix-run/react";
22+
import * as Sentry from "@sentry/remix";
23+
import { useEffect } from "react";
24+
25+
Sentry.init({
26+
dsn: "__DSN__",
27+
tracesSampleRate: 1,
28+
integrations: [
29+
new Sentry.BrowserTracing({
30+
routingInstrumentation: Sentry.remixRouterInstrumentation(
31+
useEffect,
32+
useLocation,
33+
useMatches,
34+
),
35+
}),
36+
],
37+
});
38+
```
39+
40+
Initialize Sentry in your entry point for the server to capture exceptions and get performance metrics for your [`action`](https://remix.run/docs/en/v1/api/conventions#action) and [`loader`](https://remix.run/docs/en/v1/api/conventions#loader) functions. You can also initialize Sentry's database integrations, such as Prisma, to get spans for your database calls:
41+
42+
```javascript
43+
import { prisma } from "~/db.server";
44+
45+
import * as Sentry from "@sentry/remix";
46+
47+
Sentry.init({
48+
dsn: "__DSN__",
49+
tracesSampleRate: 1,
50+
integrations: [new Sentry.Integrations.Prisma({ client: prisma })],
51+
});
52+
```
53+
54+
Lastly, wrap your Remix root with `withSentry` to catch React component errors and to get parameterized router transactions:
55+
56+
```javascript
57+
import {
58+
Links,
59+
LiveReload,
60+
Meta,
61+
Outlet,
62+
Scripts,
63+
ScrollRestoration,
64+
} from "@remix-run/react";
65+
66+
import { withSentry } from "@sentry/remix";
67+
68+
function App() {
69+
return (
70+
<html>
71+
<head>
72+
<Meta />
73+
<Links />
74+
</head>
75+
<body>
76+
<Outlet />
77+
<ScrollRestoration />
78+
<Scripts />
79+
<LiveReload />
80+
</body>
81+
</html>
82+
);
83+
}
84+
85+
export default withSentry(App);
86+
```
87+
88+
Once you've verified the library is initialized properly and sent a test event, consider visiting our [complete Remix docs](https://docs.sentry.io/platforms/javascript/guides/remix/). There, you'll find additional instructions for configuring the Remix SDK.

0 commit comments

Comments
 (0)