feat(expo): Warn when prebuilt native projects are missing Sentry config#5984
Merged
feat(expo): Warn when prebuilt native projects are missing Sentry config#5984
Conversation
Contributor
Semver Impact of This PR⚪ None (no version bump detected) 📋 Changelog PreviewThis is how your changes will appear in the changelog.
🤖 This preview updates automatically when you update the PR. |
Contributor
|
5c0910a to
42d7ec5
Compare
When using the Sentry Expo Plugin with prebuilt native projects, users need to run `npx expo prebuild --clean` to apply the native changes. Without this step, source maps upload and native crash reporting won't work correctly. This adds a check in `getSentryExpoConfig()` that runs at Metro startup and inspects existing ios/android directories for Sentry markers: - iOS: looks for `sentry-xcode` or `Upload Debug Symbols to Sentry` in the pbxproj file - Android: looks for `sentry.gradle` in app/build.gradle The check only runs for Expo projects (detected via package.json) and is fully wrapped in try/catch to never crash Metro startup. Closes #4640
Tests cover: - Skipping non-Expo projects (no package.json, no expo dependency) - No warning when native dirs don't exist (managed workflow) - No warning when Sentry is properly configured (iOS and Android) - Warning when iOS, Android, or both are missing Sentry config - Detection of expo in devDependencies - Graceful error handling (fs throws, invalid JSON, no xcodeproj)
42d7ec5 to
3278965
Compare
Contributor
Author
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit e359044. Configure here.
Contributor
Author
|
@antonis this can be reviewed now |
The Expo native setup check only looked for 'sentry.gradle' in android/app/build.gradle. When using the experimental Android Gradle Plugin (enableAndroidGradlePlugin), the setup uses 'io.sentry.android.gradle' instead, causing a false positive warning. Add detection for the 'io.sentry.android.gradle' plugin string so both configuration paths are recognized.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📢 Type of change
📜 Description
Adds a Metro startup check that warns Expo users when their prebuilt native projects (
ios/andandroid/) are missing Sentry configuration.Fixes #4640
Users who add the Sentry Expo Plugin after already running
expo prebuildget no indication that their native projects are stale. This leads to confusing issues where source maps upload and native crash reporting silently fail.💚 How did you test it?
yarn build)oxlint)📝 Checklist
sendDefaultPIIis enabled