Skip to main content

[JavaScript] Why are nested objects in the context hidden?

Issue

Nested objects in my event context show as [Object] or [Array] instead of the full data. I attached this data with setContext, extra, or similar SDK APIs.

Applies To

  • All SaaS Customers and Self-Hosted Users

  • JavaScript SDKs

  • SDK Setup

Resolution

Sentry SDKs normalize contextual data to a fixed depth. Beyond that depth, the SDK stops walking the tree and replaces deeper values with their type, such as [Object] or [Array]. The default normalizeDepth is 3.

To show deeper nesting, raise normalizeDepth in Sentry.init:

Sentry.init({
  dsn: "https://[email protected]/0",
  normalizeDepth: 5,
});

If many keys are missing at the same level, also check normalizeMaxBreadth. That option limits how many properties or array entries the SDK keeps in each object or array during normalization (default 1000).

Keep normalizeDepth only as high as you need. Deep or large context payloads can push the event toward size limits and get trimmed or rejected.

See normalizeDepth and normalizeMaxBreadth in the configuration options, and context enrichment for how context data is attached.

Did this answer your question?