Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add stringified payload to metametrics controller trackEvent error message #11166

Merged
merged 2 commits into from
May 24, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion app/scripts/controllers/metametrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,17 @@ export default class MetaMetricsController {
async trackEvent(payload, options) {
// event and category are required fields for all payloads
if (!payload.event || !payload.category) {
throw new Error('Must specify event and category.');
throw new Error(
`Must specify event and category. Event was: ${
payload.event
}. Category was: ${payload.category}. Payload keys were: ${Object.keys(
payload,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we track the user's MetaMetricsId in sentry context @Gudahtt? If so tracking the entire payload is problematic here for anonymity reasons. It's likely safe here to just include the event OR category and possibly an array of keys supplied in the payload versus the values.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had the same thought, but it looks like the payload doesn't include the MetaMetricsId. That's in the options.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh but the properties and sensitiveProperties are a lot. Especially the sensitiveProperties - those explicitly should not be included for privacy reasons. Good point - I agree with your recommendation.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its also in the sentry appState context.
Screen Shot 2021-05-24 at 12 29 34 PM

)}. ${
typeof payload.properties === 'object'
? `Payload property keys were: ${Object.keys(payload.properties)}`
: ''
}`,
);
}

if (!this.state.participateInMetaMetrics && !options?.isOptIn) {
Expand Down