errorcore
Reference

Configuration Options

All options are passed to errorcore.init(). Only transport is required.

Core

OptionTypeDefaultDescription
transportTransportConfigrequiredWhere incident packages are delivered. See Transport.
encryptionKeystringundefined64-character hex string (32 bytes) for AES-256-GCM encryption. Generate with node -e "console.log(require('crypto').randomBytes(32).toString('hex'))".
allowUnencryptedbooleanfalseAllow unencrypted packages. Set to true for local development when no encryption key is available.

Capture

OptionTypeDefaultDescription
captureLocalVariablesbooleanfalseCapture local variables at the throw site via V8 Inspector.
captureRequestBodiesbooleanfalseInclude request bodies in captured incidents.
captureResponseBodiesbooleanfalseInclude response bodies in captured incidents.
captureBodybooleanfalseShorthand to enable both request and response body capture.
captureBodyDigestbooleanfalseInclude a SHA-256 digest of bodies instead of the full content.
captureDbBindParamsbooleanfalseInclude database bind parameters in the IO timeline.
bodyCaptureContentTypesstring[]["application/json", "application/x-www-form-urlencoded", "text/plain", "application/xml"]Content types eligible for body capture.

Filtering

OptionTypeDefaultDescription
headerAllowliststring[]["content-type", "content-length", "accept", "user-agent", "x-request-id", "x-correlation-id", "host"]Headers to include in captured requests.
headerBlocklistRegExp[]Patterns matching authorization, cookie, token, key, secret, password, credentialHeaders to exclude (evaluated as regex against header names).
envAllowliststring[]NODE_ENV, PORT, HOSTNAME, Kubernetes and cloud platform variablesEnvironment variables to include in the incident package.
envBlocklistRegExp[]Patterns matching key, secret, token, password, credential, auth, privateEnvironment variable names to exclude.
piiScrubber(key: string, value: unknown) => unknownundefinedCustom function to scrub or transform values before serialization. Runs in addition to the built-in scrubber.
replaceDefaultScrubberbooleanfalseWhen true, the custom piiScrubber replaces the built-in scrubber entirely instead of running alongside it.

Buffer and Performance

OptionTypeDefaultDescription
bufferSizenumber200Maximum number of IO events kept in the circular buffer. Range: 10-100000.
bufferMaxBytesnumber52428800 (50 MB)Maximum memory for the IO buffer in bytes. Minimum: 1 MB.
maxPayloadSizenumber32768 (32 KB)Maximum size of a single serialized value in bytes.
maxConcurrentRequestsnumber50Maximum number of concurrent request contexts tracked.
rateLimitPerMinutenumber60Maximum incidents captured per rate limit window.
rateLimitWindowMsnumber60000Rate limit sliding window duration in milliseconds. Minimum: 1000.
flushIntervalMsnumber5000Interval for periodic transport flush. Set to 0 to disable.

Local Variables

OptionTypeDefaultDescription
maxLocalsCollectionsPerSecondnumber20Rate limit for V8 Inspector local variable collection.
maxCachedLocalsnumber50Maximum cached local variable snapshots.
maxLocalsFramesnumber5Number of stack frames to capture locals from.

Serialization

Passed as serialization: { ... } in the config:

OptionTypeDefaultDescription
maxDepthnumber8Maximum nesting depth for cloned values.
maxArrayItemsnumber20Maximum array elements to include.
maxObjectKeysnumber50Maximum object keys to include.
maxStringLengthnumber2048Maximum string length before truncation.
maxPayloadSizenumber32768Maximum serialized size per value (32 KB).
maxTotalPackageSizenumber5242880Maximum total package size (5 MB).

Transport and Delivery

OptionTypeDefaultDescription
deadLetterPathstringauto-derivedPath to the dead-letter NDJSON file. Defaults to .errorcore-dead-letters.ndjson next to the transport file or in CWD for HTTP transport.
maxDrainOnStartupnumber100Maximum dead-letter entries to retry on SDK initialization.
uncaughtExceptionExitDelayMsnumber1500Milliseconds to wait for delivery before exiting after an uncaught exception.

Advanced

OptionTypeDefaultDescription
resolveSourceMapsbooleantrueResolve source maps in stack traces.
useWorkerAssemblybooleanfalseAssemble incident packages in a worker thread to reduce main thread blocking.
allowPlainHttpTransportbooleanfalseAllow http:// URLs for the HTTP transport (not recommended).
allowInvalidCollectorCertificatesbooleanfalseSkip TLS certificate validation for the collector (not recommended).

On this page