Capture & report errors

Use the Node.js client to report handled errors. Long-running servers flush on their own.

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. Long-running servers flush on their own. Call flush before a script or one-off process exits.

await rasputin.flush();

Client options

Options for RasputinInit. Source paths are usually inferred from your packages.

FieldRequiredWhat it does
dsnRequiredPublic project DSN from project settings. Used only to send events.
projectApiKeyRequiredSecret project API key for deploy announcement and instrumentation manifest upload.
environmentRequiredWhere the error happened, such as production or staging.
releaseRequiredThe Git commit SHA for this deployment.
moduleUrlOptionalHelps normalize local stack paths. Use import.meta.url.
repoRootOptionalA local filesystem display root. It does not control source identity.
sourceRootOptionalThe Git folder for a single-package service when automatic matching is ambiguous.
sourceRootsOptionalPackage-name to Git-folder mappings for an ambiguous monorepo.
enabledOptionalTurns reporting on or off. Defaults to true.
logSuccessOptionalPrints a configuration summary when setup succeeds. Defaults to false; set to true to enable.
scrubPIIOptionalRedact common personal data from stored runtime state (default false). Set to true to enable; secrets are always redacted.
executionRecorderOptionalTurns on the runtime recorder (arguments, returns, call history on errors).