You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/platforms/javascript/guides/remix/manual-setup.mdx
+50-60Lines changed: 50 additions & 60 deletions
Original file line number
Diff line number
Diff line change
@@ -28,11 +28,7 @@ pnpm add @sentry/remix
28
28
29
29
## Configure
30
30
31
-
To use this SDK, initialize Sentry in your Remix entry points for both the client and server.
32
-
33
-
Create two files in the root directory of your project, `entry.client.tsx` and `entry.server.tsx` (if they don't already exist). Add your initialization code in these files for the client-side and server-side SDK, respectively.
34
-
35
-
The two configuration types are mostly the same, except that some configuration features, like Session Replay, only work in `entry.client.tsx`.
31
+
To use this SDK, initialize Sentry in your Remix project for both the client and server.
// We recommend adjusting this value in production
84
-
tracesSampleRate: 1.0,
85
-
});
86
-
```
87
-
88
-
Initialize Sentry in your entry point for the server to capture exceptions and get performance metrics for your [`action`](https://remix.run/docs/en/main/route/action) and [`loader`](https://remix.run/docs/en/main/route/loader) functions.
89
-
90
69
To catch React component errors (in Remix v1) and routing transactions (in all Remix versions), wrap your Remix root with `withSentry`.
91
70
92
71
<Note>
@@ -149,6 +128,48 @@ withSentry(App, {
149
128
});
150
129
```
151
130
131
+
132
+
### Server-side Configuration
133
+
134
+
Create an instrumentation file (named here as `instrument.server.mjs`) in your project. Add your initialization code in this file for the server-side SDK.
If you use the Express server instead of the Remix built-in server, you can alternatively import your instrumentation file directly at the top of your server implementation. See the example [here](#custom-express-server).
170
+
171
+
Sentry's Remix SDK will automatically record your [`action`](https://remix.run/docs/en/main/route/action) and [`loader`](https://remix.run/docs/en/main/route/loader) transactions, as well as server-side errors. You can also initialize Sentry's database integrations, such as <Linkto="/platforms/javascript/guides/node/tracing/database/opt-in/#prisma-orm-integration">Prisma</Link>, to get spans for your database calls.
If you use a custom Express server in your Remix application, you should wrap your [`createRequestHandler` function](https://remix.run/docs/en/main/other-api/adapter#createrequesthandler) manually with `wrapExpressCreateRequestHandler`. This isn't necessary if you're using the built-in Remix App Server.
237
+
You can import your server instrumentation file at the top of your Express server implementation.
217
238
218
-
<Note>
219
-
220
-
`wrapExpressCreateRequestHandler` is available starting with version 7.11.0.
### Usage with Vite development mode (only for SDK versions < 7.106.0)
237
-
238
-
<Alertlevel='info'>
239
-
240
-
@sentry/remix version 7.106.0 introduced support for Vite development mode, so you don't need to await the build loader. It's recommended to upgrade to the latest version of @sentry/remix.
241
-
242
-
</Alert>
243
-
244
-
For SDK versions < 7.106.0, the function returned by `wrapExpressCreateRequestHandler` accepts the build object as its first parameter. So if your boilerplate code passes the argument as a function, you need to update the usage. For example, if you're using [Vite](https://remix.run/docs/en/main/future/vite), you'll need to wait for the build loader before passing it to the wrapped handler.
0 commit comments