sentry icon indicating copy to clipboard operation
sentry copied to clipboard

Custom properties in user context no longer rendering in Sentry UI

Open MattIPv4 opened this issue 1 year ago • 5 comments
trafficstars

Environment

SaaS (https://sentry.io/)

Steps to Reproduce

import Sentry from '@sentry/node'; // v7

Sentry.init(...);

Sentry.getClient().on('beforeSendEvent', event => {
    console.log('Event (before):', event);
});

Sentry.getClient().on('afterSendEvent', event => {
    console.log('Event (after):', event);
});

class Test {
    constructor() {
        this.hello = 'world';
    }

    toString() {
        return this.hello;
    }

    toJSON() {
        return { hello: this.hello };
    }
}

const user = {
    id: '1',
    hello: 'world',
    nested: { key: 'value' },
    test: new Test(),
};

console.log(user);

console.log(JSON.stringify(user, null, 4));

Sentry.setUser(user);

Sentry.setContext('test', user);

Sentry.captureException(new Error('Test error'));

Expected Result

hello + nested + test should show in the Sentry UI under the User context, like they do under the test context.

Actual Result

Custom properties show in a custom context, but not in the user context.

Screenshot 2024-05-22 at 00 31 04

I suspect this is a Sentry UI issue, rather than a library issue, as no code has changed in our applications where we send objects as part of the user context, yet they're suddenly (not sure when this actually started) no longer showing up in the Sentry UI.

Product Area

Issues

Link

No response

DSN

No response

Version

No response

MattIPv4 avatar May 21 '24 23:05 MattIPv4

Assigning to @getsentry/support for routing ⏲️

getsantry[bot] avatar May 21 '24 23:05 getsantry[bot]

My suspicion would be something along the lines of https://github.com/getsentry/sentry/pull/68081 / https://github.com/getsentry/sentry/pull/68530 as the cause of these custom properties no longer showing up, but a quick glance at the diffs doesn't reveal anything obvious that'd be no longer showing them.

MattIPv4 avatar May 21 '24 23:05 MattIPv4

Routing to @getsentry/product-owners-issues for triage ⏲️

getsantry[bot] avatar May 22 '24 00:05 getsantry[bot]

@leeandher mind taking a look to see if your changes affected this?

JoshFerge avatar May 22 '24 00:05 JoshFerge

I am completely blind when I created this evidently, but I realise now this is a dupe of #71246. I'll let y'all decide which to close/combine :)

MattIPv4 avatar May 22 '24 01:05 MattIPv4

Thanks for reporting this! I'll close this in favour of the first issue, but this should be addressed soon. Thanks!

leeandher avatar May 22 '24 16:05 leeandher