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: Async function swallowing console error

See original GitHub issue

Describe the bug

When an exception occurs in a component function with the async keyword in the signature, the error is not being logged to the console.

Steps to reproduce

  1. Pull down this repo’s master branch and run (linked below). This is a clone of the rn063example folder with the changes in App.js to reproduce what I am experiencing.
  2. When the app is running, click the red text button.
  3. Doing this is when I did not see the console error.

Environment

  • Bugsnag version: 7.3.0-alpha.12 (originally experienced on 7.5.2)
  • Browser framework version (if any):
    • React: 0.63.0 (originally experienced on 0.63.2)
  • Device (e.g. iphonex): iPhone 11 (13.2.2) and Pixel 3 XL (API 29)

Example Repo

https://github.com/ShawnCholeva/bugsnag-async-func-error

Example code snippet

Screen Shot 2020-11-18 at 3 01 24 PM

Error messages: Screen Shot 2020-11-18 at 3 01 37 PM

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
xljonescommented, Nov 20, 2020

Hey @ShawnCholeva, thanks for raising providing the repro. Confirmed the behaviour you’re seeing. We’ll take a look into this.

When running without Bugsnag enabled, we’d expect to see a warning when a possible unhandled rejection occurs: image

With Bugsnag enabled, this unhandled rejection error does get reported to Bugsnag, but it’s hidden from the console.

0reactions
evelantcommented, Feb 26, 2021

@mattdyoung this seems like it was improved in v7.6.0 but not really fixed. There is now a console log for Possible Unhandled Promise Rejection (id: 1): and a (not so useful bugsnag internals) stack but it still swallows the error message. That means you need to log into bugsnag to read any async error messages which isn’t ideal. Can this be reopened until error messages are no longer being swallowed in development?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Catch the error from an async function in react application ...
It is however still possible for async functions to mistakenly swallow errors. Take for example the parallel async function.
Read more >
Error handling with async/await and promises, n² ... - CatchJS
Browsers now have native support for doing asynchronous calls via async / await . This is nice. It is essentially syntax support for...
Read more >
Errors in async functions get swallowed · Issue #175 - GitHub
In this example, the error becomes the rejection reason for the Promise returned by the async function, so you'll want to catch it...
Read more >
async function - JavaScript - MDN Web Docs - Mozilla
The async function declaration declares an async function where the await keyword is permitted within the function body. The async and await ...
Read more >
Are JavaScript Promises swallowing your errors?
JavaScript Promises swallow your errors by default, causing untold pain while debugging. Learn how to keep yourself sane by handling errors ...
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