-
-
Notifications
You must be signed in to change notification settings - Fork 344
Fix: don't symbolicate console asserts that comes from metro. #4770
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
Draft
lucas-zimerman
wants to merge
14
commits into
main
Choose a base branch
from
lz/fix-console
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
4f7645e
Merge branch 'main' into lz/fix-console
lucas-zimerman 5136274
add fix for console loop
lucas-zimerman 3f1ff8a
fix changelog
lucas-zimerman f93d17a
merge main
lucas-zimerman e6f5273
Update samples/react-native/src/Screens/ErrorsScreen.tsx
lucas-zimerman 1b1f86f
apply requested changes
lucas-zimerman cb9ef09
apply requested changes / add sample staccktrace / new test for cons…
lucas-zimerman 2ec3cda
Merge branch 'main' of https://github.com/getsentry/sentry-react-nati…
lucas-zimerman 37be219
Merge branch 'lz/fix-console' of https://github.com/getsentry/sentry-…
lucas-zimerman 5be8e7c
Merge branch 'main' into lz/fix-console
lucas-zimerman 04431cc
fix changelog
lucas-zimerman 53a7d5f
Merge branch 'main' into lz/fix-console
lucas-zimerman 85a69df
Merge branch 'main' into lz/fix-console
lucas-zimerman f474700
fix changelog
lucas-zimerman 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
47 changes: 47 additions & 0 deletions
47
packages/core/src/js/integrations/debugsymbolicator.consoleissue.txt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
Sample stack trace when calling `symbolicateStackTrace` from debugsymbolicator, with console integration enabled, with assert filter. | ||
|
||
LOG Assertion called: true message 'this' is expected an Event object, but got [{"isTrusted":false}] stack : Error | ||
at getCurrentStackTrace (http://IP/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=io.sentry.reactnative.sample&modulesOnly=false&runModule=true:125938:26) | ||
at anonymous (http://IP/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=io.sentry.reactnative.sample&modulesOnly=false&runModule=true:125950:57) | ||
at apply (native) | ||
at anonymous (http://IP/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=io.sentry.reactnative.sample&modulesOnly=false&runModule=true:154465:27) | ||
at pd (http://IP/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=io.sentry.reactnative.sample&modulesOnly=false&runModule=true:36235:19) | ||
at setPassiveListener (http://IP/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=io.sentry.reactnative.sample&modulesOnly=false&runModule=true:36640:7) | ||
at dispatchEvent (http://IP/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=io.sentry.reactnative.sample&modulesOnly=false&runModule=true:36939:27) | ||
at setReadyState (http://IP/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=io.sentry.reactnative.sample&modulesOnly=false&runModule=true:36129:27) | ||
at open (http://IP/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=io.sentry.reactnative.sample&modulesOnly=false&runModule=true:36041:27) | ||
at apply (native) | ||
at anonymous (http://IP/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=io.sentry.reactnative.sample&modulesOnly=false&runModule=true:155583:34) | ||
at anonymous (http://IP/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=io.sentry.reactnative.sample&modulesOnly=false&runModule=true:29261:17) | ||
at tryCallTwo (http://IP/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=io.sentry.reactnative.sample&modulesOnly=false&runModule=true:204678:9) | ||
at doResolve (http://IP/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=io.sentry.reactnative.sample&modulesOnly=false&runModule=true:204817:25) | ||
at Promise (http://IP/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=io.sentry.reactnative.sample&modulesOnly=false&runModule=true:204697:14) | ||
at fetch (http://IP/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=io.sentry.reactnative.sample&modulesOnly=false&runModule=true:29218:25) | ||
at ?anon_0_ (http://IP/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=io.sentry.reactnative.sample&modulesOnly=false&runModule=true:28649:33) | ||
at next (native) | ||
at asyncGeneratorStep (http://IP/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=io.sentry.reactnative.sample&modulesOnly=false&runModule=true:28665:26) | ||
at _next (http://IP/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=io.sentry.reactnative.sample&modulesOnly=false&runModule=true:28684:29) | ||
at anonymous (http://IP/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=io.sentry.reactnative.sample&modulesOnly=false&runModule=true:28689:14) | ||
at tryCallTwo (http://IP/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=io.sentry.reactnative.sample&modulesOnly=false&runModule=true:204678:9) | ||
at doResolve (http://IP/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=io.sentry.reactnative.sample&modulesOnly=false&runModule=true:204817:25) | ||
at Promise (http://IP/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=io.sentry.reactnative.sample&modulesOnly=false&runModule=true:204697:14) | ||
at anonymous (http://IP/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=io.sentry.reactnative.sample&modulesOnly=false&runModule=true:28681:25) | ||
at apply (native) | ||
at _symbolicateStackTrace (http://IP/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=io.sentry.reactnative.sample&modulesOnly=false&runModule=true:28658:40) | ||
at apply (native) | ||
at symbolicateStackTrace (http://IP/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=io.sentry.reactnative.sample&modulesOnly=false&runModule=true:28637:40) | ||
at symbolicate (http://IP/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=io.sentry.reactnative.sample&modulesOnly=false&runModule=true:28616:52) | ||
at handleSymbolicate (http://IP/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=io.sentry.reactnative.sample&modulesOnly=false&runModule=true:28516:42) | ||
at symbolicate (http://IP/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=io.sentry.reactnative.sample&modulesOnly=false&runModule=true:28507:33) | ||
at appendNewLog (http://IP/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=io.sentry.reactnative.sample&modulesOnly=false&runModule=true:28152:25) | ||
at anonymous (http://IP/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=io.sentry.reactnative.sample&modulesOnly=false&runModule=true:28196:21) | ||
at apply (native) | ||
at anonymous (http://IP/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=io.sentry.reactnative.sample&modulesOnly=false&runModule=true:35288:26) | ||
at _callTimer (http://IP/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=io.sentry.reactnative.sample&modulesOnly=false&runModule=true:35167:17) | ||
at _callReactNativeMicrotasksPass (http://IP/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=io.sentry.reactnative.sample&modulesOnly=false&runModule=true:35212:17) | ||
at callReactNativeMicrotasks (http://IP/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=io.sentry.reactnative.sample&modulesOnly=false&runModule=true:35418:44) | ||
at __callReactNativeMicrotasks (http://IP/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=io.sentry.reactnative.sample&modulesOnly=false&runModule=true:3569:48) | ||
at anonymous (http://IP/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=io.sentry.reactnative.sample&modulesOnly=false&runModule=true:3342:45) | ||
at __guard (http://IP/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=io.sentry.reactnative.sample&modulesOnly=false&runModule=true:3541:15) | ||
at flushedQueue (http://IP/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=io.sentry.reactnative.sample&modulesOnly=false&runModule=true:3341:21) | ||
at callFunctionReturnFlushedQueue (http://IP/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=io.sentry.reactnative.sample&modulesOnly=false&runModule=true:3326:33) |
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.
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.
Let's also add a test where the assert is executed in the Promise. I believe that test would fail at the moment. Because only the code till the first
await
statement will be in the sandbox.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.
That surely breaks the test :c
We are a bit limited on what we could do here since we don't have the control on when the console log is going to happen.
I have a code proposal where we implement a delayed console sandbox, where we can control when to start logging console events after the callback was finished:
What do you think @krystofwoldrich @antonis ? It's just the normal code with some support for promises and also a timeout for restoring the sandbox after the promise/function finishes
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.
Yes, this would work, but I'm concerned about the fact, that all console log (not only the ones from the network call) will be in the sandbox until the network call (symbolication) resolves.
@lucas-zimerman @antonis Let me know what do you think, but to avoid a complex logic, since as @lucas-zimerman mention this is only for local builds, I would return to the original ignoring of the particular error causing issues.
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.
One more options that I think would be feasible is to Proxy all method calls of the XHR object https://github.com/facebook/react-native/blob/f0527d86623112eee1e80da7884081f7ecf59bea/packages/react-native/Libraries/Network/XMLHttpRequest.js#L82
so all of the method are executed in consoleSandbox, since they are all synchronous it should work nicely, not sandboxing anything outside of the network call.
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.
That sounds like a good approach to me 👍
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.
Sounds good to me, I will work on it