-
-
Notifications
You must be signed in to change notification settings - Fork 342
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
Unhandled promises are not logged at all (iOS and Android) #1077
Comments
Having the same issue. |
I am also experiencing the same issue for unhandled promises. |
I think that this is due to the same issue as this- facebook/fbjs#413 (mismatch of |
@cruzach you are right but its a big issue since it makes sentry nearly useless!
@cruzach maybe sentry should hook itself directly on |
Is this working for anybody right now with the latest versions? Just created a brand new react native project and running into the same issue. |
Same issue here with the latest versions. I am currently using @jer-sen's workaround and it works ! |
I have reproduced the issue and confirmed that unhandled promise rejections are not being caught on my end as well. Adding this to our immediate TODO. |
@jennmueng I'm still having this problem even with the latest version of the SDK. Anything I can do to help pin it down? |
@somebody32 Can you provide a reproduction for us where this occurs? |
@jennmueng happily here is my test code Sentry.init({
dsn: 'dsn',
debug: true,
});
function App() {
useEffect(() => {
(async () => { throw 'boom'; })();
}, []);
return <Button onPress={async () => { throw 'boom'; }} title="Exception" />
} and both are not sent to sentry, nothing in logs either |
@jennmueng can open another issue if you think it would be more useful, but just confirmed that it happens in "release" mode too: the app sometimes shows just a white screen because of unhandled rejection but nothing goes into sentry |
@jennmueng your fix does not work. You expect |
The fix is unfortunately not working for me either. I feel like this should get a lot more attention if it's indeed a general problem and I'm not misconfiguring something. @jennmueng I assume you have tested the fix and it's working on your side, could you maybe provide your setup information? (also, if I can do anything to help with any information please let me know) |
It looks like I've managed to make it work by forcing the particular version of "resolutions": {
"promise": "^8.1.0"
}, |
@somebody32 That sounds like the most viable workaround I have so far until Facebook fixes this. |
@jennmueng you should really remove your dependency on |
@jer-sen We do not have a dependency on We considered adding a peerDependency of 8.x for it to pull the one from React Native but that would also break people from older versions of React Native that do not use React Native >= |
@jennmueng you are right :( Then maybe you can improve your fix with some reverse engineering to find the right properties names:
Not perfect but it will work for small code change of |
I will consider your solution @jer-sen. What's really interesting if we have an unhandled promise rejection test in our end-to-end tests on CI, and they've been passing no problem on the latest React Native versions 0.63.x-0.64.x. In theory if the versions are the same, Maybe the best solution is for people to bump this PR that has been sitting for a while that would fix the source of the problem: facebook/fbjs#413 |
Maybe something wrong with your tests... // Will return undefined (_onHandle/_onReject does not exist after build script, _Y/_Z only exists with current RN version)
const _onHandle = Promise._onHandle ?? Promise._Y;
const _onReject = Promise._onReject ?? Promise._Z;
if ( // Never true since _onHandle === undefined and _onReject === undefined
Promise !== _global.Promise &&
typeof _onHandle !== "undefined" &&
typeof _onReject !== "undefined"
) {
if ("_onHandle" in _global.Promise && "_onReject" in _global.Promise) {
_global.Promise._onHandle = _onHandle;
_global.Promise._onReject = _onReject;
} else if ("_Y" in _global.Promise && "_Z" in _global.Promise) {
_global.Promise._Y = _onHandle;
_global.Promise._Z = _onReject;
}
} And by the way, I don't think you can take |
@jennmueng any update? |
@jer-sen The best solution we have now is to just wait for the PR to be merged over there. Any stopgap solution would be just prone to more issues. We will document the resolutions fix and have that be our official method for now. |
@jennmueng From the looks of this comment it seems that facebook/fbjs#413 is not going to solve this issue. Am I reading that correctly? |
|
@jennmueng as explained in my comment here facebook/fbjs#413 (comment), I think you should do 2 or 3 things to close this issue:
What do you think about all this? |
@jer-sen We're going to add a troubleshooting/install doc and I like your second idea, we will try it out and add that in. |
@jennmueng whats the outcome of it besides the pending docs? do we need to fix something on the SDK? |
@jennmueng & @marandaneto you should also clean the code by removing the current workaround when the runtime check will be implemented |
@jennmueng is currently experimenting with this #1886 |
@marandaneto I have tried your fix but in dev mode with Expo the
by
solves the issue ( |
Platform:
SDK:
@sentry/react-native
(>= 1.0.0)SDK version: "@sentry/react-native": "^1.7.2",
react-native
version: "react-native": "^0.63.2",Are you using Expo?
Are you using sentry.io or on-premise?
If you are using sentry.io, please post a link to your issue so we can take a look:
No issue was created
Configuration:
(
@sentry/react-native
)I have following issue:
Normal exceptions are logged to Sentry.io just fine, but unhandled promises are not logged at all. My understanding is that this should happen by default. I do get a yellow box showing the unhandled exception but it seems that Sentry never sees it.
This repros on both Android and iOS.
Steps to reproduce:
Actual result:
Yellow box appears but no error logged to sentry.io
Expected result:
Unhandled promise rejections are logged to sentry.io
The text was updated successfully, but these errors were encountered: