sentry-javascript: event.user is empty?

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which package are you using?

@sentry/nextjs

SDK Version

7.21.0

Framework Version

Next.js v12.3.0

Link to Sentry event

No response

Steps to Reproduce

  1. I add sendDefaultPii: true option to my sentry.client.config.js
  2. I console log the event with beforeSend(event){ console.log(event) } to see what’s sent.
  3. The event has the following properties:
{
    breadcrumbs,
    environment,
    event_id,
    exception,
    extra,
    level,
    platform,
    release,
    request,
    sdk,
    tags,
    timestamp;
}

Expected Result

I don’t see any user property, even though it’s highlighted in the Data scrubbing example

However, with sendDefaultPii: true the IP address of the client does show up in the Sentry dashboard.

Actual Result

The user property should have the clients IP address since it was enabled with sendDefaultPii

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

For certain backend frameworks in the Node SDK we grab the IP off the request object.

For browser errors, we collect the IP on our servers: https://docs.sentry.io/platforms/javascript/enriching-events/identify-user/#ip_address

To opt out of storing users’ IP addresses in your event data, you can go to your project settings, click on “Security & Privacy”, and enable “Prevent Storing of IP Addresses” or use Sentry’s server-side data scrubbing to remove $user.ip_address. Adding such a rule ultimately overrules any other logic.