Skip to content

Commit 0380116

Browse files
logaretmclaude
andcommitted
fix(elysia): Address PR review feedback on Elysia SDK guide
Align the Elysia getting-started guide with other JS guides per reviewer feedback: add onboarding option buttons, sendDefaultPii, source maps step, structured verify section with issues/tracing/logs, troubleshooting expandable, and suppress inapplicable pages (Session Replay, Installation Methods) for the Elysia platform. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent df3bb9f commit 0380116

12 files changed

Lines changed: 114 additions & 21 deletions

File tree

docs/platforms/javascript/common/install/index.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ notSupported:
2727
- javascript.azure-functions
2828
- javascript.gcp-functions
2929
- javascript.cloudflare
30+
- javascript.elysia
3031
- javascript.react-router
3132
- javascript.tanstackstart-react
3233
---

docs/platforms/javascript/common/install/loader.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ notSupported:
2626
- javascript.aws-lambda
2727
- javascript.azure-functions
2828
- javascript.connect
29+
- javascript.elysia
2930
- javascript.express
3031
- javascript.fastify
3132
- javascript.gcp-functions

docs/platforms/javascript/common/install/npm.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ notSupported:
2727
- javascript.aws-lambda
2828
- javascript.azure-functions
2929
- javascript.connect
30+
- javascript.elysia
3031
- javascript.express
3132
- javascript.fastify
3233
- javascript.gcp-functions

docs/platforms/javascript/common/session-replay/configuration.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ notSupported:
1010
- javascript.aws-lambda
1111
- javascript.azure-functions
1212
- javascript.connect
13+
- javascript.elysia
1314
- javascript.express
1415
- javascript.fastify
1516
- javascript.gcp-functions

docs/platforms/javascript/common/session-replay/index.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ notSupported:
1212
- javascript.aws-lambda
1313
- javascript.azure-functions
1414
- javascript.connect
15+
- javascript.elysia
1516
- javascript.express
1617
- javascript.fastify
1718
- javascript.gcp-functions

docs/platforms/javascript/common/session-replay/issue-types.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ notSupported:
1010
- javascript.aws-lambda
1111
- javascript.azure-functions
1212
- javascript.connect
13+
- javascript.elysia
1314
- javascript.express
1415
- javascript.fastify
1516
- javascript.gcp-functions

docs/platforms/javascript/common/session-replay/privacy.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ notSupported:
1010
- javascript.aws-lambda
1111
- javascript.azure-functions
1212
- javascript.connect
13+
- javascript.elysia
1314
- javascript.express
1415
- javascript.fastify
1516
- javascript.gcp-functions

docs/platforms/javascript/common/session-replay/troubleshooting.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ notSupported:
1010
- javascript.aws-lambda
1111
- javascript.azure-functions
1212
- javascript.connect
13+
- javascript.elysia
1314
- javascript.express
1415
- javascript.fastify
1516
- javascript.gcp-functions

docs/platforms/javascript/common/session-replay/understanding-sessions.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ notSupported:
1010
- javascript.aws-lambda
1111
- javascript.azure-functions
1212
- javascript.connect
13+
- javascript.elysia
1314
- javascript.express
1415
- javascript.fastify
1516
- javascript.gcp-functions

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

Lines changed: 103 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,18 @@ You need:
2626

2727
## Step 1: Install
2828

29+
Choose the features you want to configure, and this guide will show you how:
30+
31+
<OnboardingOptionButtons
32+
options={["error-monitoring", "performance", "logs"]}
33+
/>
34+
35+
<Include name="quick-start-features-expandable" />
36+
37+
### Install the Sentry SDK
38+
39+
Run the command for your preferred package manager to add the Sentry SDK to your application:
40+
2941
```bash {tabTitle:Bun}
3042
bun add @sentry/elysia
3143
```
@@ -52,15 +64,29 @@ import { Elysia } from "elysia";
5264

5365
Sentry.init({
5466
dsn: "___PUBLIC_DSN___",
55-
// Set tracesSampleRate to 1.0 to capture 100% of transactions
67+
// Adds request headers and IP for users, for more info visit:
68+
// https://docs.sentry.io/platforms/javascript/guides/elysia/configuration/options/#sendDefaultPii
69+
sendDefaultPii: true,
70+
// ___PRODUCT_OPTION_START___ performance
71+
72+
// Set tracesSampleRate to 1.0 to capture 100%
73+
// of transactions for tracing.
5674
// We recommend adjusting this value in production
75+
// Learn more at
76+
// https://docs.sentry.io/platforms/javascript/guides/elysia/configuration/options/#tracesSampleRate
5777
tracesSampleRate: 1.0,
58-
});
78+
// ___PRODUCT_OPTION_END___ performance
79+
// ___PRODUCT_OPTION_START___ logs
5980

60-
const app = Sentry.withElysia(new Elysia());
81+
// Enable logs to be sent to Sentry
82+
enableLogs: true,
83+
// ___PRODUCT_OPTION_END___ logs
84+
});
6185

62-
app.get("/", () => "Hello World");
63-
app.listen(3000);
86+
// withElysia returns the app instance, so you can chain routes directly
87+
const app = Sentry.withElysia(new Elysia())
88+
.get("/", () => "Hello World")
89+
.listen(3000);
6490
```
6591

6692
```javascript {tabTitle:Node.js} {filename: index.ts}
@@ -70,38 +96,88 @@ import { node } from "@elysiajs/node";
7096

7197
Sentry.init({
7298
dsn: "___PUBLIC_DSN___",
73-
// Set tracesSampleRate to 1.0 to capture 100% of transactions
99+
// Adds request headers and IP for users, for more info visit:
100+
// https://docs.sentry.io/platforms/javascript/guides/elysia/configuration/options/#sendDefaultPii
101+
sendDefaultPii: true,
102+
// ___PRODUCT_OPTION_START___ performance
103+
104+
// Set tracesSampleRate to 1.0 to capture 100%
105+
// of transactions for tracing.
74106
// We recommend adjusting this value in production
107+
// Learn more at
108+
// https://docs.sentry.io/platforms/javascript/guides/elysia/configuration/options/#tracesSampleRate
75109
tracesSampleRate: 1.0,
76-
});
110+
// ___PRODUCT_OPTION_END___ performance
111+
// ___PRODUCT_OPTION_START___ logs
77112

78-
const app = Sentry.withElysia(new Elysia({ adapter: node() }));
113+
// Enable logs to be sent to Sentry
114+
enableLogs: true,
115+
// ___PRODUCT_OPTION_END___ logs
116+
});
79117

80-
app.get("/", () => "Hello World");
81-
app.listen(3000);
118+
// withElysia returns the app instance, so you can chain routes directly
119+
const app = Sentry.withElysia(new Elysia({ adapter: node() }))
120+
.get("/", () => "Hello World")
121+
.listen(3000);
82122
```
83123

84-
`Sentry.withElysia()` returns the app instance, so you can chain routes directly:
124+
## Step 3: Add Readable Stack Traces With Source Maps (Optional)
85125

86-
```javascript
87-
const app = Sentry.withElysia(new Elysia())
88-
.get("/", () => "Hello World")
89-
.post("/users", createUser);
126+
The stack traces in your Sentry errors probably won't look like your actual code. To fix this, upload your source maps to Sentry.
127+
The easiest way to do this is by using the Sentry Wizard:
128+
129+
```bash
130+
npx @sentry/wizard@latest -i sourcemaps
90131
```
91132

92-
The SDK re-exports everything from `@sentry/bun`, so all Sentry APIs (like `captureException`, `startSpan`, `setUser`, `setTag`) are available directly from `@sentry/elysia`.
133+
## Step 4: Verify Your Setup
93134

94-
## Step 3: Verify Your Setup
135+
Let's test your setup and confirm that Sentry is working correctly and sending data to your Sentry project.
95136

96-
Add a test route that throws an error:
137+
### Issues
138+
139+
First, let's verify that Sentry captures errors and creates issues in your Sentry project. Add the following route to your app, which triggers an error that Sentry will capture:
97140

98141
```javascript
99142
app.get("/debug-sentry", () => {
100143
throw new Error("My first Sentry error!");
101144
});
102145
```
103146

104-
Visit `/debug-sentry` in your browser. The error should appear in your Sentry project within a few moments.
147+
<OnboardingOption optionId="performance">
148+
149+
### Tracing
150+
151+
To test your tracing configuration, update the previous code snippet by starting a trace to measure the time it takes for the execution of your code:
152+
153+
```javascript
154+
app.get("/debug-sentry", async () => {
155+
await Sentry.startSpan(
156+
{
157+
op: "test",
158+
name: "My First Test Transaction",
159+
},
160+
async () => {
161+
await new Promise((resolve) => setTimeout(resolve, 100));
162+
throw new Error("My first Sentry error!");
163+
}
164+
);
165+
});
166+
```
167+
168+
</OnboardingOption>
169+
170+
<OnboardingOption optionId="logs">
171+
172+
<Include name="logs/javascript-quick-start-verify-logs" />
173+
174+
</OnboardingOption>
175+
176+
### View Captured Data in Sentry
177+
178+
Finally, 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).
179+
180+
<Include name="quick-start-locate-data-expandable" />
105181

106182
## Features
107183

@@ -155,3 +231,11 @@ app.get("/checkout", () => {
155231
- Learn how to <PlatformLink to="/usage">manually capture errors</PlatformLink>
156232
- Continue to <PlatformLink to="/configuration">customize your configuration</PlatformLink>
157233
- Get familiar with [Sentry's product features](/product) like tracing, insights, and alerts
234+
235+
<Expandable permalink={false} title="Are you having problems setting up the SDK?">
236+
237+
- Check out alternative <PlatformLink to="/install">installation methods</PlatformLink>
238+
- Find various topics in <PlatformLink to="/troubleshooting">Troubleshooting</PlatformLink>
239+
- [Get support](https://sentry.zendesk.com/hc/en-us/)
240+
241+
</Expandable>

0 commit comments

Comments
 (0)