sentry
sentry copied to clipboard
Custom properties in user context no longer rendering in Sentry UI
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.
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
Assigning to @getsentry/support for routing ⏲️
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.
Routing to @getsentry/product-owners-issues for triage ⏲️
@leeandher mind taking a look to see if your changes affected this?
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 :)
Thanks for reporting this! I'll close this in favour of the first issue, but this should be addressed soon. Thanks!