From 1c78f69d52d3421ed645e3724d11a264ddf808a8 Mon Sep 17 00:00:00 2001 From: Abdelrahman Awad Date: Tue, 24 Mar 2026 15:27:41 -0400 Subject: [PATCH 1/3] docs(elysia): Add @sentry/elysia SDK documentation and icon Add getting started guide for the new @sentry/elysia package covering Bun and Node.js runtimes, error capturing, automatic tracing, and distributed trace propagation. Wire up the Elysia platform icon. Refs https://github.com/getsentry/sentry-javascript/pull/19509 Co-Authored-By: Claude --- .../javascript/guides/elysia/index.mdx | 153 ++++++++++++++++++ src/components/platformIcon.tsx | 7 + 2 files changed, 160 insertions(+) create mode 100644 docs/platforms/javascript/guides/elysia/index.mdx diff --git a/docs/platforms/javascript/guides/elysia/index.mdx b/docs/platforms/javascript/guides/elysia/index.mdx new file mode 100644 index 00000000000000..a25ae69eb7b0d5 --- /dev/null +++ b/docs/platforms/javascript/guides/elysia/index.mdx @@ -0,0 +1,153 @@ +--- +title: Elysia +description: Learn how to set up Sentry in your Elysia app to capture errors and monitor performance. +sdk: sentry.javascript.bun +fallbackGuide: javascript.bun +categories: + - javascript + - server + - server-node +--- + + + +This SDK is currently in **ALPHA**. Alpha features are still in progress, may have bugs, and might include breaking changes. +Please reach out on [GitHub](https://github.com/getsentry/sentry-javascript/issues/new/choose) if you have any feedback or concerns. + + + +## Prerequisites + +You need: + +- A Sentry [account](https://sentry.io/signup/) and [project](/product/projects/) +- An Elysia application (v1.4.0+) +- Bun or Node.js 18+ (with [@elysiajs/node](https://elysiajs.com/plugins/node) adapter) + +## Step 1: Install + +```bash {tabTitle:Bun} +bun add @sentry/elysia +``` + +```bash {tabTitle:npm} +npm install @sentry/elysia @elysiajs/node +``` + + + You do **not** need `@elysiajs/opentelemetry`. The `@sentry/elysia` SDK handles all instrumentation natively. + + +## Step 2: Configure + +Call `Sentry.init()` before creating your Elysia app, then wrap the app with `Sentry.withElysia()` before defining routes. + +```javascript {tabTitle:Bun} {filename: index.ts} +import * as Sentry from "@sentry/elysia"; +import { Elysia } from "elysia"; + +Sentry.init({ + dsn: "___PUBLIC_DSN___", + // Set tracesSampleRate to 1.0 to capture 100% of transactions + // We recommend adjusting this value in production + tracesSampleRate: 1.0, +}); + +const app = Sentry.withElysia(new Elysia()); + +app.get("/", () => "Hello World"); +app.listen(3000); +``` + +```javascript {tabTitle:Node.js} {filename: index.ts} +import * as Sentry from "@sentry/elysia"; +import { Elysia } from "elysia"; +import { node } from "@elysiajs/node"; + +Sentry.init({ + dsn: "___PUBLIC_DSN___", + // Set tracesSampleRate to 1.0 to capture 100% of transactions + // We recommend adjusting this value in production + tracesSampleRate: 1.0, +}); + +const app = Sentry.withElysia(new Elysia({ adapter: node() })); + +app.get("/", () => "Hello World"); +app.listen(3000); +``` + +`Sentry.withElysia()` returns the app instance, so you can chain routes directly: + +```javascript +const app = Sentry.withElysia(new Elysia()) + .get("/", () => "Hello World") + .post("/users", createUser); +``` + +The SDK re-exports everything from `@sentry/bun`, so all Sentry APIs (like `captureException`, `startSpan`, `setUser`, `setTag`) are available directly from `@sentry/elysia`. + +## Step 3: Verify Your Setup + +Add a test route that throws an error: + +```javascript +app.get("/debug-sentry", () => { + throw new Error("My first Sentry error!"); +}); +``` + +Visit `/debug-sentry` in your browser. The error should appear in your Sentry project within a few moments. + +## Features + +### Automatic Error Capturing + +The SDK captures 5xx errors automatically via a global `onError` hook. Client errors (3xx/4xx) are not captured by default. + +You can customize which errors are captured using the `shouldHandleError` option: + +```javascript +Sentry.withElysia(app, { + shouldHandleError: (context) => { + const status = context.set.status; + return status === 500 || status === 503; + }, +}); +``` + +### Automatic Tracing + +The SDK creates spans for every Elysia lifecycle phase: Request, Parse, Transform, BeforeHandle, Handle, AfterHandle, MapResponse, AfterResponse, and Error. + +- The Handle span uses `op: 'request_handler.elysia'`; all other lifecycle spans use `op: 'middleware.elysia'` +- Transactions use parameterized route names (e.g., `GET /users/:id`) +- Named function handlers show their function name in spans; arrow functions show as `anonymous` + +### Distributed Tracing + +The SDK automatically propagates incoming `sentry-trace` and `baggage` headers and injects trace headers into outgoing responses. No additional configuration needed. + +### Manual Spans + +You can create manual spans within your route handlers: + +```javascript +app.get("/checkout", () => { + return Sentry.startSpan({ name: "process-payment" }, () => { + // ... your code + }); +}); +``` + +## Runtime Behavior + +- **Bun**: The SDK creates root server spans via Elysia's `.wrap()` API with `continueTrace` for trace propagation. No additional runtime instrumentation needed. +- **Node.js**: The SDK uses Node's HTTP instrumentation for root spans and updates the transaction name with the parameterized route from Elysia. + +## Next Steps + +- Explore [practical guides](/guides/) on what to monitor, log, track, and investigate after setup +- Learn how to manually capture errors +- Continue to customize your configuration +- Get familiar with [Sentry's product features](/product) like tracing, insights, and alerts diff --git a/src/components/platformIcon.tsx b/src/components/platformIcon.tsx index f09c60239d42f6..fbb614fdd84851 100644 --- a/src/components/platformIcon.tsx +++ b/src/components/platformIcon.tsx @@ -42,6 +42,7 @@ import DotnetfxSVG from 'platformicons/svg/dotnetfx.svg'; import EchoSVG from 'platformicons/svg/echo.svg'; import EffectSVG from 'platformicons/svg/effect.svg'; import ElectronSVG from 'platformicons/svg/electron.svg'; +import ElysiaSVG from 'platformicons/svg/elysia.svg'; import ElixirSVG from 'platformicons/svg/elixir.svg'; import EmberSVG from 'platformicons/svg/ember.svg'; import ExpressSVG from 'platformicons/svg/express.svg'; @@ -193,6 +194,7 @@ import DotnetfxSVGLarge from 'platformicons/svg_80x80/dotnetfx.svg'; import EchoSVGLarge from 'platformicons/svg_80x80/echo.svg'; import EffectSVGLarge from 'platformicons/svg_80x80/effect.svg'; import ElectronSVGLarge from 'platformicons/svg_80x80/electron.svg'; +import ElysiaSVGLarge from 'platformicons/svg_80x80/elysia.svg'; import ElixirSVGLarge from 'platformicons/svg_80x80/elixir.svg'; import EmberSVGLarge from 'platformicons/svg_80x80/ember.svg'; import ExpressSVGLarge from 'platformicons/svg_80x80/express.svg'; @@ -488,6 +490,10 @@ const formatToSVG = { sm: ElectronSVG, lg: ElectronSVGLarge, }, + elysia: { + sm: ElysiaSVG, + lg: ElysiaSVGLarge, + }, elixir: { sm: ElixirSVG, lg: ElixirSVGLarge, @@ -993,6 +999,7 @@ export const PLATFORM_TO_ICON = { 'javascript-deno': 'deno', 'javascript-effect': 'effect', 'javascript-electron': 'electron', + 'javascript-elysia': 'elysia', 'javascript-ember': 'ember', 'javascript-express': 'express', 'javascript-gatsby': 'gatsby', From 7b7ec964d52eb8fdb217d46e4684e4f99a037a1c Mon Sep 17 00:00:00 2001 From: "getsantry[bot]" <66042841+getsantry[bot]@users.noreply.github.com> Date: Tue, 24 Mar 2026 19:29:27 +0000 Subject: [PATCH 2/3] [getsentry/action-github-commit] Auto commit --- src/components/platformIcon.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/platformIcon.tsx b/src/components/platformIcon.tsx index fbb614fdd84851..c7f51449f5afeb 100644 --- a/src/components/platformIcon.tsx +++ b/src/components/platformIcon.tsx @@ -42,8 +42,8 @@ import DotnetfxSVG from 'platformicons/svg/dotnetfx.svg'; import EchoSVG from 'platformicons/svg/echo.svg'; import EffectSVG from 'platformicons/svg/effect.svg'; import ElectronSVG from 'platformicons/svg/electron.svg'; -import ElysiaSVG from 'platformicons/svg/elysia.svg'; import ElixirSVG from 'platformicons/svg/elixir.svg'; +import ElysiaSVG from 'platformicons/svg/elysia.svg'; import EmberSVG from 'platformicons/svg/ember.svg'; import ExpressSVG from 'platformicons/svg/express.svg'; import FalconSVG from 'platformicons/svg/falcon.svg'; @@ -194,8 +194,8 @@ import DotnetfxSVGLarge from 'platformicons/svg_80x80/dotnetfx.svg'; import EchoSVGLarge from 'platformicons/svg_80x80/echo.svg'; import EffectSVGLarge from 'platformicons/svg_80x80/effect.svg'; import ElectronSVGLarge from 'platformicons/svg_80x80/electron.svg'; -import ElysiaSVGLarge from 'platformicons/svg_80x80/elysia.svg'; import ElixirSVGLarge from 'platformicons/svg_80x80/elixir.svg'; +import ElysiaSVGLarge from 'platformicons/svg_80x80/elysia.svg'; import EmberSVGLarge from 'platformicons/svg_80x80/ember.svg'; import ExpressSVGLarge from 'platformicons/svg_80x80/express.svg'; import FalconSVGLarge from 'platformicons/svg_80x80/falcon.svg'; From 1019251c43de71f9a6906ca2ff06455650cab5b7 Mon Sep 17 00:00:00 2001 From: Abdelrahman Awad Date: Tue, 24 Mar 2026 15:45:09 -0400 Subject: [PATCH 3/3] fix: 404 link --- docs/platforms/javascript/guides/elysia/index.mdx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/platforms/javascript/guides/elysia/index.mdx b/docs/platforms/javascript/guides/elysia/index.mdx index a25ae69eb7b0d5..302979898e7b01 100644 --- a/docs/platforms/javascript/guides/elysia/index.mdx +++ b/docs/platforms/javascript/guides/elysia/index.mdx @@ -22,7 +22,7 @@ You need: - A Sentry [account](https://sentry.io/signup/) and [project](/product/projects/) - An Elysia application (v1.4.0+) -- Bun or Node.js 18+ (with [@elysiajs/node](https://elysiajs.com/plugins/node) adapter) +- Bun or Node.js 18+ (with [@elysiajs/node](https://elysiajs.com/integrations/node) adapter) ## Step 1: Install @@ -30,8 +30,12 @@ You need: bun add @sentry/elysia ``` -```bash {tabTitle:npm} +```bash {tabTitle:node} npm install @sentry/elysia @elysiajs/node +# or +yarn add @sentry/elysia @elysiajs/node +# or +pnpm add @sentry/elysia @elysiajs/node ```