sentry-module icon indicating copy to clipboard operation
sentry-module copied to clipboard

normalizeDepth doesn't have any effect

Open simon-ccoms opened this issue 1 year ago • 2 comments

Version

@nuxtjs/sentry: 8.7.0 nuxt: 2.17.0

Sentry configuration

sentry: {
    dsn: process.env.SENTRY_DSN,
    clientIntegrations: {
      ExtraErrorData: {},
      ReportingObserver: { types: ['crash'] },
      HttpClient: true
    },
    config: {
      // Capture headers and cookies
      sendDefaultPii: true,

      normalizeDepth: 5,
    },
  },

Steps to reproduce

Use the above config on a route which returns a response with more than 3 levels of data in it.

What is Expected?

At least 5 levels of the data should appear on the Sentry issue.

What is actually happening?

The default value of 3 is always used, no matter what value is put into the sentry config.

simon-ccoms avatar Sep 26 '24 15:09 simon-ccoms

It works here with a manually triggered exception like this:

      this.$sentry.withScope((scope) => {
        scope.setExtra('x', {
          1: {
            2: {
              3: {
                4: {
                  5: {
                    6: {
                      7: {
                        8: {
                          9: {},
                        },
                      },
                    },
                  },
                },
              },
            },
          },
        })
        scope.captureException(new Error('Some error'))
      })

You might need to specify your problem in more details. Ideally provide actual project that reproduces your issue.

rchl avatar Sep 27 '24 08:09 rchl

I'm not entirely sure what's going on but your code does show the correct depth in the Sentry dashboard.

The code that I'm using is as follows:-

try {
	await this.$axios.post('/api/tenants/contact/', {})
} catch (error) {
	this.$sentry.captureException(error)
}

where the API throws an HTTP 400 error whose response looks like this:-

{
	"recaptcha_token": [
		"This field is required."
	]
}

But Sentry only has the following in the error info:-

response: {
	data: {
		recaptcha_token: {
			[Array]
		}
	}
}

simon-ccoms avatar Oct 01 '24 16:10 simon-ccoms