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.

Unhandled promise rejections are not logged to sentry

See original GitHub issue

My feature request is connected to the bug https://github.com/getsentry/sentry-react-native/issues/1077.

I’ve tried the solution from docs, but it didn’t work out for me. So I found another solution with polyfilling existing Promise in React Native.

I’ve used this package

import { setUnhandledPromiseRejectionTracker } from 'react-native-promise-rejection-utils';
import { getCurrentHub } from '@sentry/core';
setUnhandledPromiseRejectionTracker((id, error) => {
  getCurrentHub().captureException(error, {
    data: { id },
    originalException: error,
  });
});

Inside the react-native-promise-rejection-utils package polyfills the existing promise. You can check it out here

So I propose changing the method, removing the check for the promise version and using the package react-native-promise-rejection-utils or polyfill directly without relaying on this package.

I think this solution is better in many ways:

  1. It doesn’t require user to do or check anything. It just works
  2. _checkPromiseVersion can be removed

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
porscommented, Dec 24, 2021

I have the same issue. I did match the versions, but that doesn’t help.

grep "promise" node_modules/react-native/package.json
    "promise": "^8.0.3",
grep "promise" ./package.json
    "promise": "^8.0.3"
Possible Unhandled Promise Rejection (id: 0):
TypeError: Attempted to assign to readonly property.

Also, setting debug: true doesn’t show me the [Sentry] Unhandled promise rejections will be caught by Sentry. message.

1reaction
checklistcommented, Dec 27, 2021

I have the same issue with:

Please issue an urgent fix. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unhandled promise rejections will not be caught by Sentry ...
Unhandled promise rejections will not be caught by Sentry. Read about how to fix this on our troubleshooting page.
Read more >
Sentry React Native unhandled promise rejections are not ...
I have configured @sentry/react-native in a newly created expo bare project, and while I'm able to log issues using Sentry.
Read more >
Performance monitoring is not uploaded by sentry-expo
I faced the same issue by following expo-documentation. As they do not mention performance monitoring, one parameter is missing in the init:
Read more >
Usage
While a user is logged in, you can tell Sentry to associate errors with user ... By default, Raven.js capture unhandled promise rejections...
Read more >
JavaScript - Docs - Sentry Documentation
By default, Sentry for JavaScript captures unhandled promise rejections as ... In case the source map files do not contain your original source...
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