Skip to content

Commit 4cc1241

Browse files
committed
update Solid quick start guide
1 parent 9309019 commit 4cc1241

File tree

4 files changed

+103
-35
lines changed

4 files changed

+103
-35
lines changed

docs/platforms/javascript/guides/solid/features/error-boundary.mdx

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,4 @@ from inside a component tree and render a fallback component.
88

99
Wrap the native Solid `ErrorBoundary` component with `Sentry.withSentryErrorBoundary`.
1010

11-
```jsx
12-
import * as Sentry from "@sentry/solid";
13-
import { ErrorBoundary } from "solid-js";
14-
15-
// Wrap Solid"s ErrorBoundary to automatically capture exceptions
16-
const SentryErrorBoundary = Sentry.withSentryErrorBoundary(ErrorBoundary);
17-
18-
export default function SomeComponent() {
19-
return (
20-
<SentryErrorBoundary fallback={err => <div>Error: {err.message}</div>}>
21-
<div>Some Component</div>
22-
</SentryErrorBoundary>
23-
);
24-
}
25-
```
11+
<PlatformContent includePath="getting-started-capture-errors" />

docs/platforms/javascript/guides/solid/index.mdx

Lines changed: 80 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
---
22
title: Solid
33
sdk: sentry.javascript.solid
4+
description: Learn how to manually set up Sentry in your Solid app and capture your first errors.
45
categories:
56
- javascript
67
- browser
78
---
89

10+
<Alert>
11+
This SDK guide is specifically for Solid. For instrumenting your SolidStart
12+
app, visit [here](/platforms/javascript/guides/solidstart).
13+
</Alert>
14+
915
<PlatformContent includePath="getting-started-prerequisites" />
1016

11-
## Install
17+
## Step 1: Install
1218

13-
Sentry captures data by using an SDK within your application's runtime.
19+
Run the command for your preferred package manager to add the Sentry SDK to your application:
1420

1521
```bash {tabTitle:npm}
1622
npm install @sentry/solid --save
@@ -24,11 +30,9 @@ yarn add @sentry/solid
2430
pnpm add @sentry/solid
2531
```
2632

27-
## Configure
28-
29-
In addition to capturing errors, you can monitor interactions between multiple services or applications by [enabling tracing](/concepts/key-terms/tracing/). You can also get to the root of an error or performance issue faster, by watching a video-like reproduction of a user session with [session replay](/product/explore/session-replay/web/getting-started/).
33+
## Step 2: Configure
3034

31-
Select which Sentry features you'd like to install in addition to Error Monitoring to get the corresponding installation and configuration instructions below.
35+
Choose the features you want to configure, and this guide will show you how:
3236

3337
<OnboardingOptionButtons
3438
options={[
@@ -40,11 +44,11 @@ Select which Sentry features you'd like to install in addition to Error Monitori
4044
]}
4145
/>
4246

43-
Configuration should happen as early as possible in your application's lifecycle.
47+
<PlatformContent includePath="getting-started-features-expandable" />
4448

45-
To use the SDK, initialize it in your Solid entry point before bootstrapping your app. In a typical Solid project, that is your `index.jsx` file.
49+
### Initialize the Sentry SDK
4650

47-
<Alert>We currently support Solid 1.8.4 and up.</Alert>
51+
Initialize Sentry as early as possible in your application, for example, in your `index.(jsx|tsx)` file:
4852

4953
```javascript {filename: index.jsx}
5054
import * as Sentry from "@sentry/solid";
@@ -114,31 +118,87 @@ if (!app) throw new Error("No #app element found in the DOM.");
114118
render(() => <App />, app);
115119
```
116120

117-
Once you've done this, the SDK will automatically capture unhandled errors and promise rejections, and monitor performance in the client. You can also [manually capture errors](/platforms/javascript/guides/solid/usage).
121+
## Step 3: Capture Solid Errors
122+
123+
To automatically report exceptions from inside a component tree to Sentry, wrap Solid's `ErrorBoundary` with Sentry's helper function:
124+
125+
<PlatformContent includePath="getting-started-capture-errors" />
126+
127+
## Step 4: Add Readable Stack Traces With Source Maps (Optional)
128+
129+
<PlatformContent includePath="getting-started-sourcemaps-short-version" />
118130

119-
<PlatformContent includePath="getting-started-sourcemaps" />
131+
## Step 5: Avoid Ad Blockers With Tunneling (Optional)
120132

121-
## Verify
133+
<PlatformContent includePath="getting-started-tunneling" />
122134

123-
This snippet includes an intentional error, so you can test that everything is working as soon as you set it up.
135+
## Step 6: Verify Your Setup
136+
137+
Let's test your setup and confirm that Sentry is working correctly and sending data to your Sentry project.
138+
139+
### Issues
140+
141+
To verify that Sentry captures errors and creates issues in your Sentry project, add the following test button to one of your pages:
124142

125143
```javascript
126144
<button
127145
type="button"
128146
onClick={() => {
129-
throw new Error("Sentry Frontend Error");
147+
throw new Error("Sentry Test Error");
130148
}}
131149
>
132-
Throw error
150+
Break the world
133151
</button>
134152
```
135153

136-
This snippet adds a button that throws an error in a Solid component.
154+
<OnboardingOption optionId="performance" hideForThisOption>
155+
Open the page in a browser and click the button to trigger a frontend error.
156+
</OnboardingOption>
137157

138-
<Alert>
158+
<PlatformContent includePath="getting-started-browser-sandbox-warning" />
139159

140-
Learn more about manually capturing an error or message in our <PlatformLink to="/usage/">Usage documentation</PlatformLink>.
160+
<OnboardingOption optionId="performance">
161+
### Tracing
162+
To test your tracing configuration, update the previous code snippet to start a trace to measure the time it takes for the execution of your code:
141163

142-
</Alert>
164+
```javascript
165+
<button
166+
type="button"
167+
onClick={() => {
168+
Sentry.startSpan({ op: "test", name: "Example Frontend Span" }, () => {
169+
setTimeout(() => {
170+
throw new Error("Sentry Test Error");
171+
}, 99);
172+
});
173+
}}
174+
>
175+
Break the world
176+
</button>
177+
```
178+
179+
Open the page in a browser and click the button to trigger a frontend error and trace.
180+
181+
</OnboardingOption>
182+
183+
### View Captured Data in Sentry
184+
185+
Now, head over to your project on [Sentry.io](https://sentry.io/) to view the collected data (it takes a couple of moments for the data to appear).
186+
187+
<PlatformContent includePath="getting-started-verify-locate-data" />
188+
189+
## Next Steps
190+
191+
At this point, you should have integrated Sentry into your Solid application and should already be sending data to your Sentry project.
192+
193+
Now's a good time to customize your setup and look into more advanced topics. Our next recommended steps for you are:
194+
195+
- Extend Sentry to your backend using one of our [SDKs](/)
196+
- Continue to <PlatformLink to="/configuration">customize your configuration</PlatformLink>
197+
- Make use of <PlatformLink to="/features">Solid-specific features</PlatformLink>
198+
- Learn how to <PlatformLink to="/usage">manually capture errors</PlatformLink>
199+
200+
<Expandable permalink={false} title="Are you having problems setting up the SDK?">
201+
- Find various topics in <PlatformLink to="/troubleshooting">Troubleshooting</PlatformLink>
202+
- [Get support](https://sentry.zendesk.com/hc/en-us/)
143203

144-
To view and resolve the recorded error, log into [sentry.io](https://sentry.io) and select your project. Clicking on the error's title will open a page where you can see detailed information and mark it as resolved.
204+
</Expandable>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
```jsx
2+
import * as Sentry from "@sentry/solid";
3+
import { ErrorBoundary } from "solid-js";
4+
5+
// Wrap Solid's ErrorBoundary to automatically capture exceptions
6+
const SentryErrorBoundary = Sentry.withSentryErrorBoundary(ErrorBoundary);
7+
8+
export default function SomeComponent() {
9+
return (
10+
<SentryErrorBoundary fallback={(err) => <div>Error: {err.message}</div>}>
11+
<div>Some Component</div>
12+
</SentryErrorBoundary>
13+
);
14+
}
15+
```
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## Prerequisites
2+
3+
You need:
4+
5+
- A Sentry [account](https://sentry.io/signup/) and [project](/product/projects/)
6+
- Your application up and running
7+
- Solid version `1.8.4`+

0 commit comments

Comments
 (0)