question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

React Native - Possible Unhandled Promise Rejections

See original GitHub issue

Similar issue as in https://github.com/bugsnag/bugsnag-js/issues/1519, but I can’t even get it working in a brand new create react app. Posted a comment on that issue. Creating this issue for more visibility.

Describe the bug

When Errors (such as TypeError) happen within an Async function that’s not wrapped in a try/catch (such as a function used for the onPress prop), they are not reported to BugSnag.

Steps to reproduce

  1. Create a new React Native project using npx react-native init BugSnagUnhandledRejections --version 0.65.2
  2. Install BugSnag using npx @bugsnag/react-native-cli init, and choose latest (7.17.3)
    • Add appropriate API_KEY when prompted
  3. Add Bugsnag.start() to App component.
  4. Add a button which calls an async function when pressed
  5. See warning log in bundler console, but nothing in Bugsnag
  6. For more robust testing, have a non-async function be called for onPress and don’t await the async function when calling (or wrap in a try/catch)

Environment

  • Bugsnag version: 7.17.3
  • React-Native: 0.65.2
  • React: 17.0.2
  • Device (e.g. iphonex): iPhone Simulator and OnePlus 6T

Example code snippet

// Step 5
const boom = async () => {
  null.reject();
};

// Step 7
const asyncPress = async () => {
  Bugsnag.notify(new Error('create-react app test'));
  await boom();
};

// Step 7
const press = () => {
  asyncPress();
  null.goBoom();
};
Error messages:
Not Logged Logged
image image

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
luke-beltoncommented, Aug 16, 2022

Hi @ians-shipt - thanks for raising this, I’ve been able to reproduce this on v0.65 of React Native as per your steps above, but not on v0.64. We’re currently investigating and will keep you updated on this thread 👍

0reactions
andrecrimbcommented, Nov 22, 2022

@ians-shipt I’m facing a similar issue, to which React Native version did you upgrade to solve this problem?

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Native: Possible unhandled promise rejection
Click on your project in the Project Navigator · Open the Info tab · Click on the down arrow left to the "App...
Read more >
Possible Unhandled Promise Rejection (id:0) #7107 - GitHub
If this object is disturbed or locked, return a new promise rejected with a TypeError. Simply said, the following is likely to produce...
Read more >
React Native Auth0 Possible Unhandled Promise Rejection
Possible Unhandled Promise Rejection (id: 1): TypeError: undefined is not an object (evaluating '_yield$getCredentials.accessToken').
Read more >
React Native Auth0 Possible Unhandled Promise Rejection
My understanding of the error is that it is saying, 'we can't find any value for the Auth0Module object property you are looking...
Read more >
bugsnag/plugin-react-native-unhandled-rejection - Yarn
This plugin hooks in to React Native's promise rejection tracking to provide unhandled exception reporting for Promises. It is included in the Expo...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found