[RNMobile] Add crash logging options initial prop#32768
[RNMobile] Add crash logging options initial prop#32768
Conversation
|
Size Change: +25.9 kB (+2%) Total Size: 1.07 MB
ℹ️ View Unchanged
|
| let sentryModule = RNSentry() | ||
| sentryModule.gutenbergBridge = bridgeModule | ||
| sentryModule.dataSource = dataSource |
There was a problem hiding this comment.
The Sentry native module is explicitly instantiated here because it requires access to the bridge and data source.
| func gutenbergDidRequestMediaFilesSaveCancelDialog(_ mediaFiles: [[String: Any]]) | ||
|
|
||
| // Crash logging - Sentry | ||
| func gutenbergDidLogSentryEnvelope(_ envelope: [String: Any]) |
There was a problem hiding this comment.
The React Native SDK sends the events as envelopes, it's basically an object that contains all the data required to ingest an event into Sentry. This function will be used by the Sentry native module to send the events to the main apps (code reference).
|
Looks like the app is trying to send events even when they're disabled, so I'll review that part and push a fix. Here is a log extracted from the iOS console: Thanks @antonis for spotting it 🙇 ! |
|
After discussing this integration with @mchowning, we noticed that adding Sentry-specific code to the Gutenberg repo could violate the policy against adding data-gathering code. For this purpose, I decided to explore the option of moving the Sentry native module to the main apps to reduce as much as possible the references to Sentry in this repo. I made the changes in a different branch ( |
This issue has been fixed in this commit from GB-mobile. |
gutenberg-mobilePR: wordpress-mobile/gutenberg-mobile#3629WordPress-iOSPR: wordpress-mobile/WordPress-iOS#16700Automattic-Tracks-iOSPR: Automattic/Automattic-Tracks-iOS#183Description
This PR adds the Sentry native module and includes new functions to the Gutenberg bridge that would allow JS exceptions. be logged to Sentry via the main apps.
How has this been tested?
Preparation:
gutenberg/add/sentry-react-nativefrom WordPress-iOS repo and install dependencies with the commandrake dependenciesthrow new Error( 'Exception test' );npm run bundle:ios && cp -rf bundle/ios ../WordPress-iOS/Pods/Gutenberg/bundlegutenberg/add/sentry-react-nativebranch should be17.8.0.20210716), the version can be fetched from this file and the source maps can be checked by navigating to the URLhttps://sentry.io/settings/a8c/projects/wordpress-ios/source-maps/<VERSION>/.The source maps will be automatically uploaded during the release process but in case we might need to manually upload them, we could run the command
bundle exec fastlane upload_gutenberg_sourcemaps internal:truein the WordPress-iOS project. For this purpose, you would need to generate an API token in Sentry and include it in thewpios-envfile.NOTE: For version
17.8.0.20210716I already uploaded source maps.Generate Sentry issue:
Me/App Settings/Debug/Crash Logging.localDeveloper.Sentry event example: https://sentry.io/organizations/a8c/issues/2524917124/?environment=localDeveloper&project=1438083&query=is%3Aunresolved&statsPeriod=1h
Screenshots
Native crash:

Types of changes
New feature
Checklist:
*.native.jsfiles for terms that need renaming or removal).