Release candidate — 1.0.0-rc.1
StitchAPI

Sentry

A Sentry TraceSink that maps the stitch event stream to breadcrumbs and captures error events with the call's context — metadata-only, safe on a secret-bearing seam.

The logger sinks (@stitchapi/pino, core's loggerSink) and the OTLP bridge cover logs and traces; Sentry's model is different — a trail of breadcrumbs leading up to a captured error. @stitchapi/sentry is a TraceSink that maps the stitch event stream onto it: routine events become breadcrumbs, and an error event is captured as a Sentry issue with the call's context — so the breadcrumb trail attaches automatically.

Bring your own Sentry. The sink imports no SDK — it talks to a small structural surface that @sentry/node, @sentry/browser, @sentry/react, and friends all satisfy. There's no @sentry/* dependency.

Example

npm install @stitchapi/sentry stitchapi

stitchapi is the only peer dependency; pass whichever @sentry/* SDK you already run.

Usage

sentrySink(Sentry) returns a TraceSink. Pass it as a seam's trace and every call now reports through Sentry:

import * as Sentry from '@sentry/node';
import { sentrySink } from '@stitchapi/sentry';
import { seam } from 'stitchapi';

const api = seam({
    baseUrl: 'https://api.example.com',
    trace: sentrySink(Sentry),
});

The same sink works on a single stitch — stitch({ trace: sentrySink(Sentry) }).

What it sends

EventSentry
errorcaptureMessage (level error) + an error breadcrumb
progress (retry/circuit)breadcrumb, level warning
progress (throttle/paginate)breadcrumb, level debug
driftbreadcrumb (level follows the finding); captured with captureDrift
start / result / donebreadcrumb only when lifecycle: true (off by default)
delta / infonever sent (raw response data / strategy announcements)

Options: { lifecycle?, captureErrors?, captureDrift? }.

Metadata only, by design. A custom TraceSink receives the raw event — core only redacts inside its own built-in sinks. So this sink sends only the stitch name, method, redacted URL (the query string is stripped — it can carry ?api_key=…), status, attempt counts, drift path/level/change, phase, and timing. It never sends event.input (its headers still hold the live authorization / cookie), the response value, or a delta chunk — safe on a secret-bearing seam regardless of core's trace redaction.

See also

On this page