Skip to content

Commit bddcab0

Browse files
committed
docs(remix): Add README for remix
1 parent 30ee9e1 commit bddcab0

File tree

1 file changed

+87
-1
lines changed

1 file changed

+87
-1
lines changed

packages/remix/README.md

Lines changed: 87 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,90 @@
66

77
# Official Sentry SDK for Remix
88

9-
This SDK is work in progress, and should not be used before officially released.
9+
[![npm version](https://img.shields.io/npm/v/@sentry/nextjs.svg)](https://www.npmjs.com/package/@sentry/remix)
10+
[![npm dm](https://img.shields.io/npm/dm/@sentry/nextjs.svg)](https://www.npmjs.com/package/@sentry/remix)
11+
[![npm dt](https://img.shields.io/npm/dt/@sentry/nextjs.svg)](https://www.npmjs.com/package/@sentry/remix)
12+
[![typedoc](https://img.shields.io/badge/docs-typedoc-blue.svg)](http://getsentry.github.io/sentry-javascript/)
13+
14+
This SDK is considering experimental and in an alpha state. It may experience breaking changes. Please reach out on [GitHub](https://github.com/getsentry/sentry-javascript/issues/new/choose) if you have any feedback/concerns.
15+
## General
16+
17+
This package is a wrapper around `@sentry/node` for the server and `@sentry/react` for the client, with added functionality related to Next.js.
18+
19+
To use this SDK, init Sentry in your remix entry points for both the client and server.
20+
21+
```javascript
22+
// entry.client.tsx
23+
24+
import { useLocation, useMatches } from "@remix-run/react";
25+
import * as Sentry from "@sentry/remix";
26+
import { useEffect } from "react";
27+
28+
Sentry.init({
29+
dsn: "__DSN__",
30+
tracesSampleRate: 1,
31+
integrations: [
32+
new Sentry.BrowserTracing({
33+
routingInstrumentation: Sentry.remixRouterInstrumentation(
34+
useEffect,
35+
useLocation,
36+
useMatches,
37+
),
38+
}),
39+
],
40+
// ...
41+
});
42+
```
43+
44+
```javascript
45+
// entry.server.tsx
46+
47+
import { prisma } from "~/db.server";
48+
49+
import * as Sentry from "@sentry/remix";
50+
51+
Sentry.init({
52+
dsn: "__DSN__",
53+
tracesSampleRate: 1,
54+
integrations: [new Sentry.Integrations.Prisma({ client: prisma })],
55+
// ...
56+
});
57+
```
58+
59+
To set context information or send manual events, use the exported functions of `@sentry/remix`.
60+
61+
```javascript
62+
import * as Sentry from '@sentry/remix';
63+
64+
// Set user information, as well as tags and further extras
65+
Sentry.configureScope(scope => {
66+
scope.setExtra('battery', 0.7);
67+
scope.setTag('user_mode', 'admin');
68+
scope.setUser({ id: '4711' });
69+
// scope.clear();
70+
});
71+
72+
// Add a breadcrumb for future events
73+
Sentry.addBreadcrumb({
74+
message: 'My Breadcrumb',
75+
// ...
76+
});
77+
78+
// Capture exceptions, messages or manual events
79+
Sentry.captureMessage('Hello, world!');
80+
Sentry.captureException(new Error('Good bye'));
81+
Sentry.captureEvent({
82+
message: 'Manual',
83+
stacktrace: [
84+
// ...
85+
],
86+
});
87+
```
88+
89+
## Sourcemaps and Releases
90+
91+
The Remix SDK provides a script that automatically creates a release and uploads sourcemaps.
92+
93+
On release, call `sentry-upload-sourcemaps` to upload source maps and create a release. To see more details on how to use the command, call `sentry-upload-sourcemaps --help`.
94+
95+
For more advanced configuration, [directly use `sentry-cli` to upload source maps.](https://github.com/getsentry/sentry-cli).

0 commit comments

Comments
 (0)