Skip to main content
Configuration options control the behavior of the Sentry SDK.

Basic Options

dsn

string
The Data Source Name tells the SDK where to send events. Required for sending data to Sentry.

environment

string
default:"production"
The environment your application is running in.

release

string
The release version of your application. Used to track regressions and associate source maps.

dist

string
The distribution identifier. Used to disambiguate build or deployment variants.

Sampling Options

sampleRate

number
default:"1.0"
Sample rate for error events. Value between 0.0 (0%) and 1.0 (100%).

tracesSampleRate

number
Sample rate for transaction events. Value between 0.0 (0%) and 1.0 (100%).

tracesSampler

function
Dynamic sampling function for fine-grained control over trace sampling.

Event Processing

beforeSend

function
Called before sending error events. Can modify or drop events.

beforeSendTransaction

function
Called before sending transaction events.

beforeBreadcrumb

function
Called before adding a breadcrumb. Can modify or drop breadcrumbs.

Integrations

integrations

Integration[]
required
List of integrations to enable. See Integrations for details.

Data Limits

maxBreadcrumbs

number
default:"100"
Maximum number of breadcrumbs to keep.

maxValueLength

number
default:"250"
Maximum string length before truncation.

normalizeDepth

number
default:"3"
Maximum depth to traverse in objects.

normalizeMaxBreadth

number
default:"1000"
Maximum properties/elements in arrays or objects.

Filtering

ignoreErrors

Array<string | RegExp>
default:"[]"
Errors matching these patterns won’t be sent.

ignoreTransactions

Array<string | RegExp>
default:"[]"
Transactions matching these patterns won’t be sent.

allowUrls

Array<string | RegExp>
default:"[]"
Only send errors from URLs matching these patterns.

denyUrls

Array<string | RegExp>
default:"[]"
Don’t send errors from URLs matching these patterns.

Tracing

tracePropagationTargets

TracePropagationTargets
Control which outgoing requests get tracing headers. See Propagation for details.

propagateTraceparent

boolean
default:"false"
Enable W3C traceparent header propagation.

Transport

transport

function
required
Transport factory function. Usually provided by the SDK.

transportOptions

TransportOptions
Options for the transport. See Transport Options for details.

tunnel

string
Proxy endpoint for forwarding events.

Debug Options

debug

boolean
default:"false"
Enable debug logging.

enabled

boolean
default:"true"
Enable or disable the SDK.

Privacy

sendDefaultPii

boolean
default:"false"
Send personally identifiable information by default.

Server Options

serverName

string
Server or device name.

shutdownTimeout

number
default:"2000"
Milliseconds to wait before shutdown.

Complete Example