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 #8509

Merged
merged 91 commits into from
Feb 2, 2024
Merged

Conversation

Cal-L
Copy link
Contributor

@Cal-L Cal-L commented Feb 1, 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 requested a review from a team as a code owner February 1, 2024 23:41
Copy link
Contributor

github-actions bot commented Feb 1, 2024

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.

@Cal-L Cal-L added the regression-RC DEPRECATED: Please use "regresssion-RC-x.y.z" label instead label Feb 1, 2024
@Cal-L Cal-L force-pushed the fix/8352-source-map-stack-trace branch from e2e1d26 to 6ef4720 Compare February 1, 2024 23:49
@codecov-commenter
Copy link

codecov-commenter commented Feb 1, 2024

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (5c2082d) 40.67% compared to head (e8dab6e) 40.66%.

Files Patch % Lines
app/util/sentry/utils.js 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8509      +/-   ##
==========================================
- Coverage   40.67%   40.66%   -0.01%     
==========================================
  Files        1240     1240              
  Lines       30011    30013       +2     
  Branches     2870     2870              
==========================================
  Hits        12206    12206              
- Misses      17107    17109       +2     
  Partials      698      698              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

socket-security bot commented Feb 1, 2024

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@sentry/react-native@5.11.1 network Transitive: environment, eval, filesystem, shell, unsafe +384 160 MB sentry-bot

🚮 Removed packages: npm/@sentry/react-native@5.8.1, npm/stack-beautifier@1.0.2

View full report↗︎

@Cal-L Cal-L added the Run Smoke E2E Triggers smoke e2e on Bitrise label Feb 1, 2024
Copy link
Contributor

github-actions bot commented Feb 1, 2024

E2E test started on Bitrise: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/8822a127-24bd-4d4a-b6f2-26802c001cd1
You can also kick off another Bitrise E2E smoke test by removing and re-applying the (Run Smoke E2E) label

index.js Show resolved Hide resolved
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 2, 2024

@Cal-L Cal-L merged commit 7c51abc into main Feb 2, 2024
26 checks passed
@Cal-L Cal-L deleted the fix/8352-source-map-stack-trace branch February 2, 2024 00:45
@github-actions github-actions bot locked and limited conversation to collaborators Feb 2, 2024
@metamaskbot metamaskbot added release-7.17.0 Issue or pull request that will be included in release 7.17.0 release-7.16.0 Issue or pull request that will be included in release 7.16.0 and removed release-7.17.0 Issue or pull request that will be included in release 7.17.0 labels Feb 2, 2024
@metamaskbot
Copy link
Collaborator

Missing release label release-7.16.0 on PR. Adding release label release-7.16.0 on PR and removing other release labels(release-7.17.0), as PR was cherry-picked in branch 7.16.0.

@chrisleewilcox chrisleewilcox added release-7.17.0 Issue or pull request that will be included in release 7.17.0 and removed release-7.16.0 Issue or pull request that will be included in release 7.16.0 labels Feb 16, 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