Sentry-javascript: Deeply nested objects not serialized

Created on 9 Feb 2020  路  4Comments  路  Source: getsentry/sentry-javascript

I have the same problem as #1964. However, my extra data is coming from a call to captureEvent. This seems to ignore the depth setting and only serialize to one level.

Needs Information Needs Reproduction

Most helpful comment

See: https://github.com/getsentry/sentry-javascript/pull/2404

You should be able to change it with Sentry.init({ normalizeDepth: 5 }) or other value. I'm still tinkering how to approach marrying this external integration and this new global config option.

All 4 comments

What's your setup and which version are you using?

@sentry/node (latest), and the following init:

Sentry.init({
    dsn: /* elided */,
    environment: process.env['ENVIRONMENT'] ?? 'unknown',
    integrations: (integrations) => [
        ...integrations.filter(x => !(x instanceof RewriteFrames) && !(x instanceof ExtraErrorData)),
        new RewriteFrames({
            root: global.__rootdir__
        }),
        new ExtraErrorData({ depth: 10 }),
    ],
});

Then I merely just call:

captureEvent({
    message: 'Defining object bundle',
    extra: { definitions: defs },
    level: Severity.Debug
});

The result is that "defs" does not have 10 depths of data, but rather is very shallow.

See: https://github.com/getsentry/sentry-javascript/pull/2404

You should be able to change it with Sentry.init({ normalizeDepth: 5 }) or other value. I'm still tinkering how to approach marrying this external integration and this new global config option.

Thanks!

Was this page helpful?
0 / 5 - 0 ratings