Skip to content

SDK options

All options accepted by init() from @opslane/sdk, mirrored from SdkInitOptions and the defaults object in packages/sdk/src/config.ts. The drift check fails the repository test gate (pnpm test, which CI runs) if the type and this page disagree.

OptionTypeDefaultDescription
apiKeystring(required)Project-scoped public ingest key. It must start with opslane_pk_; init refuses to start without it.
endpointstringhttps://app.opslane.comYour Opslane instance; validated as an http(s) URL.
releasestring''Optional immutable deployment identifier; source maps match by debug ID.
environmentstring''Optional deployment name sent with events and session initialization. The server uses it only when payload overrides are enabled for the project; existing session environment assignment takes precedence.
maxBreadcrumbsnumber50Ring-buffer size for breadcrumbs attached to each event.
breadcrumbMaxAgenumber30000Milliseconds before a breadcrumb is considered stale and dropped.
flushIntervalnumber5000Milliseconds between transport flushes.
maxBatchSizenumber10Maximum events per flush.
debugbooleanfalseLog SDK-internal problems to the console.
reporting{ enabled?: boolean }{ enabled: true }Lightweight session registration. Independent of the session-recording setting; set enabled: false to suppress /api/v1/sessions/init, which also prevents recording from starting. Error-event delivery is unaffected.
replay{ enabled?: boolean }{ enabled: true }Session recording. On by default. Set enabled: false to opt out; a project-wide recording switch also exists on the server. Needs CompressionStream support.
sampleRatenumber1Fraction of events sent; clamped to [0, 1].
errorThrottleMsnumber1000Minimum interval between reports of the same error.
beforeSend(event) => event | nullundefinedFinal hook: mutate the outgoing payload or return null to drop it.

Opslane calls the identifier embedded in a built file and its source map a debug ID. It uses the debug ID to match the two.

Metadata for matching source maps is assembled from the final redacted stack immediately before beforeSend, so the hook can inspect, alter, or remove debug_meta and commit_sha like any other event field.

The Vite debug-ID and source-map upload plugin accepts:

OptionTypeDefaultDescription
commitShastringdetectedExplicit build commit; must be lowercase 40- or 64-character hex.
stampbooleantrueAdds the same build identifier to each built file and source map, then records it in the browser.
logLevel'silent' | 'warn''warn'Controls plugin warnings and the build summary.
sourcemaps'remove' | 'keep''remove'Keeps or removes map assets with build identifiers from the output.
maxMapBytesnumber33554432Raw source-map size limit. Oversized maps and chunks are left unchanged.

Uploads require one private build-time variable, OPSLANE_SOURCEMAP_KEY: the key carries the Opslane server origin it was created for, so it configures both the credential and the destination. See the source-map guide.

Related exports: captureException(err), setUser({ id }), clearUser(), destroy(), opslaneVuePlugin, and (from @opslane/sdk/react) OpslaneErrorBoundary / captureReactError. The @opslane/sdk/vite-plugin export adds build identifiers to source maps and uploads them during production builds. See the SDK README.