-
-
Notifications
You must be signed in to change notification settings - Fork 359
feat(expo): Automatically detect Release name and version for Expo Web #4910
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
Closed
Closed
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
cbfc0b0
Automatically detect Release name and version for Expo Web
antonis 5104299
Add changelog entry
antonis f891890
Adds tests
antonis fbc3e60
Merge branch 'main' into antonis/expo-web-release-version
antonis 3118011
Merge branch 'main' into antonis/expo-web-release-version
antonis f2648ba
Use expo constants for production
antonis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i: We should mention that it only works in development builds.
If you try it on a release build you'll not get the release number
https://sentry-sdks.sentry.io/issues/6673524305/events/04e3a3759a7c4cc5bd4a63038d0c2d9b/?project=5428561
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point Lucas 👍
I think this is something we should tackle for the enhancement to make sense.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the application name and version are not available in production, I would not added it at all, to avoid confusing users with differences between dev and prod.
If Expo doesn't include any of the information in production on web, we could include the release name during the build (bundling process), utilizing our Sentry Metro Plugin.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @lucas-zimerman 👋
I've updated the PR with f2648ba to handle the release build case (example). The downside is that it depends on expo-constants and will fail if it is not available. I've tested other approaches like bundle injection, but either didn't work or they were overcomplicated for the task at hand.
I think this approach is simple and would work on most cases. As a fallback the user's can still set the release manually on the web as they do now. Let me know wdyt and I can clean up the PR and prepare it for review 🙇
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @antonis and @lucas-zimerman,
I've taken a look at this again and I think the SDK should not depend on
expo-constants, to keep compatibility with non-expo apps. I would also avoid the ENVs approach since it doesn't work both prod and dev.I would propose to use a custom module to load a global variable with the release information. This will work for both prod and dev.
Similar to how Sentry JS Webpack Plugin is doing it, link.
This is, how it could be implemented: v7...krystofwoldrich:sentry-react-native:@krystofwoldrich/inject-expo-app-release#diff-de4a1259c31e8b44b35788d85ff5eb3d27eef51e73325b3ee41532d9095722cd
Let me know, if this would work for you, I can open a PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for taking the time to look at this @krystofwoldrich. Your feedback is always welcome :)
I agree. This makes sense only as a best effort approach for expo web.
Your approach looks great and of course a PR is more than welcome 🤗
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me know, if anything else is needed.