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: Fix/8352 source map stack trace #8467

Merged
merged 89 commits into from
Feb 1, 2024
Merged

Conversation

Cal-L
Copy link
Contributor

@Cal-L Cal-L commented Jan 30, 2024

Description

These changes fixes incorrect stack traces for errors on Sentry. Changes include:

  • Bundle JS and upload files to Sentry using native scripts on iOS and gradle on Android
  • In addition to uploading source maps, upload missing debug symbols for both iOS and Android
  • Disable automatic Sentry file upload by default on both platforms
  • Enable automatic Sentry file upload via environment variable SENTRY_DISABLE_AUTO_UPLOAD = false

Future improvements

  • Replace Logger class with beforeSend and beforeBreadcrumbs in Sentry configuration
  • Enable configuration for multiple environments in build script
  • Documentation for Sentry implementation and usage
  • Upload source maps and debug files to Bitrise for future reference (Deploy Source Map will fail for now on Bitrise but will not block)

Related issues

Fixes:

Manual testing steps

Note: Reference your own Sentry instance to see results. These tests focuses on having correct source maps as well as debug files uploaded to Sentry.

  • By default, Sentry auto file upload is disabled for all but release builds (app store builds)
  • To enable it for other build variants, you would need to set SENTRY_DISABLE_AUTO_UPLOAD env var to "false"
  • If auto upload is enabled, both source maps and debug files should be uploaded to the Sentry instance that ties the release and dist to the associated release
  • The end result, errors appearing on Sentry should contain the correct stack trace both for iOS and Android

Screenshots/Recordings

Before

Broken stack traces
image

After

Accurate stack traces
image

Caveat: Some errors may show with ses as the top level stack trace. We are working towards eliminating that layer so the error is more explicit. Drilling into the error still shows the correct trace so this is a non-blocker
image

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.

Cal-L and others added 30 commits January 24, 2024 14:01
- Make error stacks also available by the error instance stack
- Preserve error stack filtered content
- Like we do in metamask-extension
- Improve error debugging in Sentry

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

https://github.com/MetaMask/metamask-extension/blob/develop/app/scripts/lockdown-run.js#L6
- Show full raw error info for each deep stack lvl
- Preserve 'noise' that the default 'concise' option removes
- Improve error debugging in Sentry

https://github.com/endojs/endo/blob/master/packages/ses/docs/reference.md#options-quick-reference
@Cal-L Cal-L marked this pull request as ready for review January 30, 2024 23:24
@Cal-L Cal-L added regression-RC DEPRECATED: Please use "regresssion-RC-x.y.z" label instead needs-qa Any New Features that needs a full manual QA prior to being added to a release. and removed needs-qa Any New Features that needs a full manual QA prior to being added to a release. labels Jan 30, 2024
@github-actions github-actions bot added the Run Smoke E2E Triggers smoke e2e on Bitrise label Jan 30, 2024
Copy link
Contributor

E2E test started on Bitrise: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/445f3f6f-737f-424b-a5f4-908b6edae042
You can also kick off another Bitrise E2E smoke test by removing and re-applying the (Run Smoke E2E) label

README.md Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
scripts/build.sh Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
sethkfman
sethkfman previously approved these changes Feb 1, 2024
Copy link
Contributor

@sethkfman sethkfman left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

sonarcloud bot commented Feb 1, 2024

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@Cal-L Cal-L merged commit 583ce06 into main Feb 1, 2024
29 checks passed
@Cal-L Cal-L deleted the fix/8352-source-map-stack-trace branch February 1, 2024 16:20
@github-actions github-actions bot locked and limited conversation to collaborators Feb 1, 2024
@metamaskbot metamaskbot added the release-7.17.0 Issue or pull request that will be included in release 7.17.0 label Feb 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
regression-RC DEPRECATED: Please use "regresssion-RC-x.y.z" label instead release-7.17.0 Issue or pull request that will be included in release 7.17.0 Run Smoke E2E Triggers smoke e2e on Bitrise team-mobile-platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants