Skip to main content
Use Sentry when you want hosted error monitoring, traces, and logs for a Bun-hosted Redop server. This page follows the Bun setup model from Sentry and shows how to apply it to a Redop app.

Prerequisites

You need:
  • a Sentry account and project
  • a Redop server running on Bun

Step 1: Install

Add the Bun SDK to your project:

Step 2: Initialize Sentry early

Initialize Sentry before you import the rest of your app. Create instrument.ts at the project root:

Step 3: Preload the instrumentation file

Start Bun with --preload so Sentry initializes before your Redop server code runs.

Step 4: Capture Redop errors with context

Sentry can capture unhandled Bun errors automatically, but Redop also gives you a clean place to attach request metadata with onError(...).

Step 5: Verify the setup

Trigger a deliberate failure and confirm it appears in Sentry.
After you call the tool, check your Sentry project for:
  • the captured error in Issues
  • any traces in Traces if tracing is enabled
  • any structured log entries in Logs if logs are enabled

Add source maps

If your production stack traces are minified, upload source maps:

Bun limitation for bundled code

Sentry’s Bun auto-instrumentation depends on module loading hooks. If you bundle your app into a single file, use manual instrumentation instead of relying on the preload-based setup.

Next steps

  • tune tracesSampleRate for production traffic
  • add tags or extra context from ctx.requestId, tool names, tenant IDs, or auth metadata
  • upload source maps before production deploys
  • review Sentry’s Bun docs for tracing, logs, and advanced configuration

See also