Skip to main content

Configuration

Beta

This page documents the Bugsee JavaScript SDK, which is in beta (0.1.x) and can change between betas.

You configure the SDK with the options object you pass as the second argument of launch(appToken, options). Every option is optional. Option names are plain camelCase names, such as captureNetwork. The same names work on every runtime that has the option.

import { launch } from '@bugsee/bugsee';

launch('<your_app_token>', {
appVersion: '1.4.2',
appBuild: '381',
captureNetworkBodies: false,
maxRecordingTime: 30,
onError: (error) => console.error(error),
});

Which options exist depends on the runtime. This page has a section for each:

The TypeScript types are the exact reference for your version: BugseeLaunchOptionsWithPerformance in the browser and BugseeNodeLaunchOptions on Node.js, both exported from @bugsee/bugsee.

Invalid values​

The SDK checks every option it reads. An invalid value never throws. It is reported through onError, and the option takes a safe value:

  • On-by-default capture options turn off. captureLogs, captureNetwork, captureNetworkBodies, captureSystemTraces, captureSystemEvents and captureBreadcrumbs are on by default. A value that is not true or false (0, null, '', 'false') turns the option off, so a mistake never leaves capture running.
  • Options that collect more data stay off. Only true (or an options object, where one is accepted) turns on an option that defaults to off, such as captureLocalVariables, captureSourceContext and captureUserIdle.
  • Other options keep their default. For instance detectCrashes and captureNetworkDefaultSanitizer keep their default, which is on.
  • Protective options stay protective. startInBlackout and diskProtection treat any value other than false as on.

Pass onError while you integrate, so you see these messages.

Shared options​

These options exist on every runtime. Where a default differs by runtime, the table says so.

App identity​

OptionTypeDefaultDescription
endpointstringhttps://api.bugsee.comAPI origin, without a trailing slash.
appIdstringnonePackage or bundle identifier of your app.
appVersionstringdetectedVersion of your app. Detected from build-time constants, then the environment, then package.json (servers) or meta tags (browser). Falls back to 0.0.0. See Quick start.
appBuildstringdetectedBuild of your app, detected the same way.
sdkVersionstringpackage versionSDK version reported in the environment. You rarely need to set it.

Capture​

OptionTypeDefaultDescription
captureLogsbooleantrueCapture console output as logs. See Console logs.
captureLogsLevel'error' | 'warning' | 'info' | 'debug' | 'verbose' or 1-5'verbose'Lowest log level to capture.
captureNetworkbooleantrueCapture network requests. See Network events.
captureNetworkBodiesbooleantrueCapture request and response bodies.
maxNetworkBodySizenumber20480Largest body to capture, in bytes.
captureNetworkBodyWithoutTypebooleanfalseCapture a body even when its Content-Type is missing or blank.
captureNetworkDefaultSanitizerbooleantrueApply the built-in redaction to URLs, headers, bodies and error text. A network filter you set replaces it; see Privacy: Network.
captureBreadcrumbsbooleantrueCapture breadcrumbs. Mobile Bugsee SDKs default this to off; JavaScript keeps it on. See Breadcrumbs.
captureSystemTracesbooleantrueCapture periodic system traces (memory, CPU, event-loop lag and so on, depending on the runtime).
captureSystemEventsbooleantrueCapture system events (process or page lifecycle and similar).
maxRecordingTimenumber60Rolling recording window, in seconds.
maxDataSizenumber50 Node.js and Bun and Electron main, 20 browser (30 with the IndexedDB store), 10 edge and workersSize of the rolling capture buffer, in megabytes.

Detection and reporting​

OptionTypeDefaultDescription
detectCrashesbooleantrueDetect uncaught errors and unhandled promise rejections. See Errors & crashes.
detectHttpErrorsbooleanfalseReport HTTP 5xx responses as error reports, once per session for each method, templated URL and status. 4xx responses, transport failures and aborted requests are not reported. See HTTP errors.
reportDefaultCrashPrioritypriority'blocker'Severity a crash report starts with.
reportDefaultErrorPrioritypriority'high'Severity an error report starts with.
reportDefaultBugPrioritypriority'high'Severity a bug report starts with when none is given. The browser report dialog pre-selects it.
notifyFlushDelaynumber0notify() batching window, in milliseconds. 0 sends as soon as the current tick ends.

A priority is one of 'verylow', 'low', 'medium', 'high', 'critical' or 'blocker'.

Callbacks​

OptionTypeDefaultDescription
onError(error: unknown) => voidno-opReceives internal SDK problems: invalid options, a failed provider, a repeated launch(), a missing token.
lifecycleEventsListener(eventType: string, data?: unknown) => voidnoneObserves launch, stop, blackout and report events, from the very first Launching event. See Lifecycle & status.

Browser​

These options apply to the browser build, and so also to the browser side of the framework adapters and to Electron renderers.

Capture and persistence​

OptionTypeDefaultDescription
captureInteractionsbooleantrueCapture user interactions: presses become entries of the SDK's input stream, and changes, submits and focus become UI breadcrumbs.
captureViewHierarchybooleantrueCapture the DOM view hierarchy when a report is made.
captureUrlbooleantrueRecord the page address, sanitized, as the url system trace. Needs captureSystemTraces.
urlSanitizer(url: string) => string | nullnoneYour own sanitizer for the url trace. It runs after the default one and gets its result. Return null to record nothing for that URL. A throw records nothing.
captureAsyncOriginsbooleantrueRecord where asynchronous platform calls (such as video.play()) were made, so a rejection with no stack still has a call site. Only false opts out.
captureEnvironmentHintsbooleantrueObserve hints such as a private-browsing heuristic, reported as a system event.
captureUserIdlebooleanfalseRecord the user_idle_state trace. Only works when the page's idle-detection permission is already granted; the SDK never asks for it.
persistUserIdentifierbooleanfalseKeep the user identifier set with setUserIdentifier in localStorage, so it survives a reload. Off by default because the identifier is often personal data and a browser can be shared. Call clearUserIdentifier() on logout.
startInBlackoutbooleanfalseLaunch with a blackout already in force, so visual and interaction capture stays off until endBlackout(). See Lifecycle & status.
persistbooleanon when the page has IndexedDB and Web LocksKeep the capture window and the report queue in IndexedDB so they survive a reload. true forces it, false keeps everything in memory.
recoverbooleantrueRe-upload a report left behind by an earlier reload or crash. Needs a persistent store.
captureDiskSpacebooleanfalseAdd low-storage states to the capture trace. Needs a durable store.
diskProtectionbooleantrueStop persisting replay, log and network data when the browser's storage quota runs low. Only false opts out.

Session replay​

replay is on by default and masks aggressively. Pass false to turn it off, or an object to tune it. See Session replay and Privacy: Session replay.

launch('<your_app_token>', {
replay: {
maskTextSelector: '.account-balance',
blockSelector: '.secret-panel',
canvas: { fps: 2, quality: 0.6 },
},
});
OptionTypeDefaultDescription
replayboolean | objecttruefalse disables replay. An invalid value (null, 0, a string, an array) turns it off and is reported.
replay.maskAllTextbooleantrueMask every text node.
replay.maskAllInputsbooleantrueMask every input value.
replay.blockAllMediabooleantrueBlock all media and iframes.
replay.blockAllCanvasbooleanfalseBlock every canvas except those marked to show.
replay.maskTextSelectorstringnoneCSS selector of extra elements whose text to mask.
replay.blockSelectorstringnoneCSS selector of extra elements to block.
replay.ignoreSelectorstringnoneCSS selector of elements whose input events to ignore.
replay.checkoutEveryNmsnumber60000Interval, in milliseconds, between full snapshots. It bounds the retained window.
replay.canvasboolean | { fps?, quality?, imageType? }offOpt-in canvas recording. Defaults when on: fps 2, quality 0.6, imageType 'image/webp'. It records pixels without masking, so use it only for canvases without sensitive content.

Replay needs a DOM. In a DOM-less host, such as a server-side render pass, nothing is recorded whatever this option says.

Report dialog​

These options shape the dialog that showReportDialog() shows; see Bug reporting.

OptionTypeDefaultDescription
reportSummaryRequiredbooleanfalseThe summary must be filled in before Send.
reportDescriptionRequiredbooleanfalseThe description must be filled in.
reportEmailRequiredbooleanfalseThe reporter's email must be filled in.
reportLabelsEnabledbooleanfalseShow the labels field.
reportLabelsRequiredbooleanfalseAt least one label is required. Only with reportLabelsEnabled.
reportPrioritySelectorEnabledbooleanfalseShow the severity picker.

Node.js and Bun​

These options apply to @bugsee/bugsee on Node.js, to @bugsee/bun, and to the main process of Electron. Bun takes the same options as Node.js, with the exceptions noted.

Process and capture buffer​

OptionTypeDefaultDescription
appRootstringprocess.cwd()Application root, used to turn stack-frame paths into relative ones. Pass '' to keep absolute paths.
deviceIdstringnoneDevice identifier. The SDK never generates or stores one on a server.
appIdentitySource() => { version?, build? } | undefinednoneAn extra place to look for the version and build, consulted after build-time constants and before the environment and package.json.
unhandledRejections'preserve' | 'warn' | 'none''preserve''preserve' captures the rejection, then reproduces Node.js's own outcome (print and exit with code 1). 'warn' captures and prints but keeps the process alive. 'none' installs no listener.
exitOnUncaughtbooleantrueFlush the crash report, then exit with code 1 after an uncaught exception. Does not affect rejections.
shutdownTimeoutMsnumber3000Time budget, in milliseconds, to flush the crash report before exiting.
recoverbooleantrueStore each report durably before upload and re-upload any left behind by a crashed or killed run on the next launch. Needs the on-disk store.
capturedDataStore'disk' | 'memory''disk'Where the rolling capture buffer lives. 'memory' gives up durable capture and crash recovery.
dataDirstring<os tmpdir>/bugsee/...Directory for on-disk data. Several processes can share one directory safely; each uses its own subdirectory.
dataRootBasestringos.tmpdir()Base for the default data directory. Ignored when dataDir is set.
captureWriter'inline' | 'worker''inline''worker' writes capture data from a worker thread, so a slow disk never blocks your code.
captureDiskSpacebooleanfalseReport free and total disk space of the data volume as system traces.
diskProtectionbooleantrueBelow 50 MiB free the on-disk store stops persisting replay, log and network data; below 10 MiB it persists nothing. The in-memory window is kept either way. Only false opts out.

Diagnostics​

OptionTypeDefaultDescription
detectHangsbooleantrueDetect a blocked event loop and report an AppHang. See Hangs.
hangFairMsnumber3000Block duration, in milliseconds, reported as AppHang::Fair.
hangMediumMsnumber5000Block duration reported as AppHang::Medium.
hangSevereMsnumber10000Block duration reported as AppHang::Severe.
profilingbooleanfalseAttach a rolling V8 CPU profile (profile.json) to reports. Costs some overhead.
profilingSamplingIntervalMicrosnumber1000CPU profiler sampling interval, in microseconds.
captureLocalVariablesboolean | objectfalseCapture the local variables in scope at a throw, onto the stack frames. Always off on Bun.
captureSourceContextboolean | objectfalseAttach the source lines around each throwing application frame. It uploads your source code, so it is opt-in.

captureLocalVariables costs about 3% steady-state in internal benchmarks (approximate, not repeated for every release) because it enables the V8 debugger, and pausing on caught exceptions costs more on every throw. Variable names that look sensitive are redacted and values are truncated, but a variable can still hold personal data. Pass an object to tune it:

OptionTypeDefaultDescription
includeCaughtbooleanfalseAlso capture at caught exceptions, not only uncaught ones. Costly in code that uses exceptions for control flow.
maxFramesnumber5Frames to capture.
maxVariablesnumber20Variables per frame.
maxValueLengthnumber120Longest captured value, in characters.
maxCaughtPerSecondnumber50Rate limit for caught exceptions. Uncaught exceptions are never limited.

captureSourceContext takes an object with these keys:

OptionTypeDefaultDescription
contextLinesnumber5Lines before and after the throwing line.
maxFramesnumber5Frames to attach source to.
maxLineLengthnumber200Longest line kept, in characters.

See Diagnostics.

Incoming requests and trace propagation​

OptionTypeDefaultDescription
instrumentIncomingRequestsbooleantrueInstrument incoming requests on node:http servers and Bun.serve: a per-request context and an http.server transaction. Only false opts out; an invalid value is treated as off and reported. See Backend overview.
propagateTracebooleantrueAdd the W3C traceparent header and a bugsee trace state to outgoing requests. Nothing is added unless the URL matches tracePropagationTargets.
tracePropagationTargetsArray<string | RegExp>noneWhich outgoing URLs may receive trace headers (substring or regular expression). List your own services only.
traceResponse{ traceresponse?, serverTiming?, timingAllowOrigin? }offAdd trace context to incoming responses so a browser frontend can adopt the backend's span.

Electron​

launchMain(appToken, options) in the main process takes every Node.js option above, plus:

OptionTypeDefaultDescription
ipcMainElectron ipcMainrequiredUsed to receive capture from renderers and to control them.
appElectron appnoneReports app.getVersion() as the app version, process metrics, and renderer-gone events.
powerMonitorElectron powerMonitornoneEnables power and thermal events and traces.
screenElectron screennoneEnables display events and the displays trace. Pass it after the app is ready.
BrowserWindowElectron BrowserWindownoneTracks windows that already exist.
gpuInfoType'basic' | 'complete''basic'Detail level of the GPU information read from app.getGPUInfo.
captureWindowEventsbooleantrueWindow focus, show and hide events and renderer responsiveness. Needs app.
crashReporterElectron crashReporternoneEnables native crash collection.
crashReporterExtraRecord<string, string>noneExtra fields sent with native crashes.
video{ source, ... }offOpt-in pixel video next to the default DOM replay.

launchRenderer(appToken, options) takes the browser options above. Replay is on and streams to the main process. See Electron.

Edge and workers​

Cloudflare Workers, Vercel Edge and Web or Service Workers take the shared options above, with these changes: maxDataSize defaults to 10 and there are no options for disk, hangs or profiling. Edge runtimes buffer in memory and upload only when an incident happens.

OptionApplies toTypeDefaultDescription
partitionCaptureByTenantCloudflare, Vercel Edgebooleantrue on Cloudflare, false on Vercel EdgeKeep a separate capture buffer for each tenant so one isolate serving several tenants never mixes their data.
maxTenantPartitionsCloudflare, Vercel Edgenumber8Tenant buffers kept. The maxDataSize budget is divided across them.
asyncLocalStorageCloudflare, Vercel Edgeobjectprobed from globalThisThe async store for per-request context. Supply it where the runtime does not expose one.
platformTypeVercel Edge, Cloudflare, Web and Service WorkersstringVercel Edge 'edge-light', Cloudflare 'workers'; workers are detected ('service-worker' inside a Service Worker, else 'web-worker')Runtime identity reported with a report. Set 'service-worker' explicitly if detection fails.
persistWeb Workers, Service Workersbooleantrue for Service Workers, false for Web WorkersKeep report bundles in IndexedDB and re-upload any a stopped worker left behind.
recoverWeb Workers, Service WorkersbooleantrueRe-upload a bundle left behind by an earlier activation.

See Cloudflare, Vercel Edge and Web Workers.

Extension options​

@bugsee/bugsee adds performance monitoring and OpenTelemetry on top of the platform build, and these options on top of the platform options. The bare platform packages do not have them.

OptionTypeDefaultDescription
performanceMonitoringbooleantrueMaster switch for web vitals and performance transactions.
performanceSampleRatenumber1Fraction of transactions to keep, from 0 to 1. Errors are never sampled.
performanceUploadMode'batched' | 'realtime''batched'Upload on an interval, or per transaction.
performanceFlushIntervalMsnumber30000Interval for batched uploads, in milliseconds.
pageNamestringcurrent path, or pageloadName of the page-load transaction (browser).
traceNavigationsbooleantrueOpen a navigation transaction for each single-page route change (browser).
traceInteractionsbooleantrueOpen a ui.interaction transaction for slow user interactions (browser).
propagateTracebooleanbrowser false, server trueAdd traceparent and trace state to outgoing requests. In the browser, same-origin requests propagate and other origins need tracePropagationTargets.
tracePropagationTargetsArray<string | RegExp>noneURLs allowed to receive trace headers.
tracePropagationOriginstringlocation.originBrowser: the origin treated as same-origin.
appStartTimeMsnumberprocess start timeServer: start time used for the startup transaction.
otelExportUrlstring | URLnoneOTLP/HTTP JSON traces endpoint. When set, finished transactions are also exported there, and Bugsee still receives them.
otelExportHeadersRecord<string, string>noneHeaders for the OTLP export, lowercase keys.
otelExportResourceRecord<string, unknown>noneOTLP resource attributes.
otelConsumebooleanfalseTurn your OpenTelemetry spans into Bugsee transactions.
onOtelSpanProcessor(processor) => voidnoneReceives the span processor to register on your TracerProvider.

The performance and propagation options need performanceMonitoring on. See Performance and OpenTelemetry.

Reading options back​

The client reports what is in effect:

const bugsee = await launch('<your_app_token>', { maxRecordingTime: 30 });

bugsee.getLaunchOptions(); // effective options, defaults applied
bugsee.getHostLaunchOptions(); // only the options you passed

Both return a plain object keyed by the canonical option identifier, com.bugsee.option.* (for example com.bugsee.option.capture.network), the names shared by the Bugsee SDKs on every platform. Option objects such as replay or captureLocalVariables appear as true.

Options kept by relaunch()​

relaunch(options) starts from defaults, as the mobile SDKs do: the options you pass replace the previous ones, and omitted options go back to their default. Identity and integration settings are kept from the previous launch: endpoint, appId, appVersion, appBuild, appRoot, dataDir, onError and urlSanitizer. The network, log and breadcrumb filters and the report handler are installed on the client, not passed as options, so they are not kept: install them again on the client that relaunch() returns. See Lifecycle & status.

  • Quick start — add the package, launch the SDK and send a first report.
  • Lifecycle & status — launch, stop, relaunch and events.
  • Privacy — masking and redaction options.
  • Diagnostics — profiling, local variables and source context.
  • Packages — which package takes which options.
Found an issue, typo, or wrong statement on this page? Report it now →