Capture & report errors
Use the Bun client to report handled errors and finish sending events before short-lived work exits.
Capture exceptions
Uncaught errors are reported automatically. Call captureException for errors you handle yourself. To
attach runtime recorder evidence, pass observation from scope.observeError(error).
try {
await chargeCustomer();
} catch (error) {
const observation = scope.observeError(error);
rasputin.captureException(error, { observation });
}Send pending events before exit
Events send in the background. Call flush before a
short-lived process exits. Long-running servers flush on their own.
await rasputin.flush();Client options
Options for RasputinInit. Source paths are usually
inferred from your packages.
| Field | Required | What it does |
|---|---|---|
dsn | Required | Public project DSN from project settings. Used only to send events. |
projectApiKey | Required | Secret project API key for deploy announcement and instrumentation manifest upload. |
environment | Required | Where the error happened, such as production or staging. |
release | Required | The Git commit SHA for this deployment. |
moduleUrl | Optional | Helps normalize local stack paths. Use import.meta.url. |
repoRoot | Optional | A local filesystem display root. It does not control source identity. |
sourceRoot | Optional | The Git folder for a single-package service when automatic matching is ambiguous. |
sourceRoots | Optional | Package-name to Git-folder mappings for an ambiguous monorepo. |
enabled | Optional | Turns reporting on or off. Defaults to true. |
logSuccess | Optional | Prints a configuration summary when setup succeeds. Defaults to true. |
scrubPII | Optional | Redact common personal data from stored runtime state (default true). Secrets are always redacted. |
executionRecorder | Optional | Turns on the runtime recorder (arguments, returns, call history on errors). |
