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

fix: filter SES from Sentry stack trace frames #8584

Merged
merged 3 commits into from
Feb 26, 2024
Merged

fix: filter SES from Sentry stack trace frames #8584

merged 3 commits into from
Feb 26, 2024

Conversation

leotm
Copy link
Contributor

@leotm leotm commented Feb 14, 2024

Description

SES is shown at the top of the stack trace, but we don't have a lockdown (repairIntrinsics) option to hide it yet

this simply removes the SES frame from the Sentry error event stack trace

we identify this with ease by the filename, rather than the verbose context_line

here's an example of a SES Sentry error event stack trace frame that we remove:

    {
      "colno":25,
      "context_line":"        error=  construct(FERAL_ERROR, rest, new.target);",
      "filename":"app:///ses.cjs",
      "function":"Error",
      "in_app":true,
      "lineno":7575,
      "platform":"javascript",
      "post_context":[
        "Array"
      ],
      "pre_context":[
        "Array"
      ]
    },

https://docs.sentry.io/platforms/javascript/configuration/filtering

https://github.com/endojs/endo/blob/master/packages/ses/docs/reference.md#options-quick-reference

Related issues

Fixes: #8586

Manual testing steps

  • create personal Sentry account
  • npx @sentry/wizard
  • update sentry.properties
  • update app/util/sentry/utils.js
    • Sentry.init({dsn: xxx})
  • yarn setup
  • enable SES in debug-mode (here)
  • <Button title='Try!' onPress={ () => { Sentry.captureException(new Error('First error')) }}/>
  • test a handled Sentry.captureException('test')
  • test a Sentry.nativeCrash()
  • test an unhandled throw new Error('test')
  • observe error on sentry.io
  • Error(ses) no longer seen
  • app:///ses.cjs frame no longer present in stack trace
  • app:///ses.cjs still present in breadcrumbs

Screenshots/Recordings

Before

Screenshot 2024-02-14 at 9 07 15 pm Screenshot 2024-02-14 at 9 08 27 pm

After

Screenshot 2024-02-14 at 9 07 37 pm Screenshot 2024-02-14 at 9 08 53 pm

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've clearly explained what problem this PR is solving and how it is solved.
  • I've linked related issues
  • I've included manual testing steps
  • I've included screenshots/recordings if applicable
  • I’ve included tests if applicable
  • I’ve documented my code using JSDoc format if applicable
  • I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.
  • I’ve properly set the pull request status:
    • In case it's not yet "ready for review", I've set it to "draft".
    • In case it's "ready for review", I've changed it from "draft" to "non-draft".

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

Copy link

sonarcloud bot commented Feb 14, 2024

@leotm leotm marked this pull request as ready for review February 14, 2024 21:38
@leotm leotm requested a review from a team as a code owner February 14, 2024 21:38
@leotm leotm requested a review from Cal-L February 14, 2024 21:39
@github-actions github-actions bot added the Run Smoke E2E Triggers smoke e2e on Bitrise label Feb 14, 2024
Copy link
Contributor

E2E test started on Bitrise: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/70f511ec-47ef-4c78-b34d-7f23ce02d229
You can also kick off another Bitrise E2E smoke test by removing and re-applying the (Run Smoke E2E) label

Copy link
Contributor

@Cal-L Cal-L left a comment

Choose a reason for hiding this comment

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

Lgtm

@leotm leotm merged commit 6841a91 into main Feb 26, 2024
49 checks passed
@leotm leotm deleted the fix-stack-trace branch February 26, 2024 11:38
@github-actions github-actions bot locked and limited conversation to collaborators Feb 26, 2024
@metamaskbot metamaskbot added the release-7.18.0 Issue or pull request that will be included in release 7.18.0 label Feb 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release-7.18.0 Issue or pull request that will be included in release 7.18.0 Run Smoke E2E Triggers smoke e2e on Bitrise team-lavamoat
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hide SES Sentry error event stack trace frame
3 participants