Open ignaciosantise opened 1 month ago
Hi @ignaciosantise,
you appear to have multiple versions of the "promise" package installed. This may cause unexpected behavior like undefined Promise.allSettled
. Please install the promise
package manually using the exact version as the React Native package.
In your case that is:
npm i promise@8.3.0
Detailed information here: https://docs.sentry.io/platforms/react-native/troubleshooting/#disable-auto-patching
Hi @krystofwoldrich 👋 thanks for the info
Adding a resolution solves the issue 👌
The sample project i provided is a brand new project and it already has this issue, so maybe worth exploring why Sentry uses the wrong promise package? So users don't have to do some hacks to solve this.
Anyway, thanks for your help 🤝
Also an improvement for your docs here https://docs.sentry.io/platforms/react-native/troubleshooting/#manually-forcing-a-package-resolution
Package resolutions are currently only supporred by yarn. If you use npm, you can use a third-party package called npm-force-resolutions to achieve this.
You can do that by using overrides
in NPM
{
"overrides": {
"promise": "^8.0.3"
}
}
Might be related(?).
We also got this issue after updating yarn to v3, which was part of the latest react native upgrade. We had multiple versions of promise before, but only got this problem after updating yarn.
Adding resolutions
field to package.json fixed it for us.
Thank you @ignaciosantise, we will add this to the docs.
What can we do to improve the situation?
global.HermesInternal?.enablePromiseRejectionTracker?.()
.For RN Web use the Sentry Browser JS rejection tracking https://github.com/getsentry/sentry-javascript/blob/27876437b7cf33e2a78b455d36d5b8102f17b878/packages/utils/src/instrument/globalUnhandledRejection.ts#L24
When in JSC projects check the RN version and the allSettled
to provide better error message, which guides users to adding the latest Promise
package.
Promise
package. Will increase bundle size.Promise
package as dependency. Might cause dep conflicts and goes against Sentry's SDKs no deps strategy.
OS:
Platform:
SDK:
@sentry/react-native
(>= 1.0.0)react-native-sentry
(<= 0.43.2)SDK version: 0.0.0
react-native
version: 5.26.0Are 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:
Link
Configuration:
(
@sentry/react-native
)I have the following issue:
Promise.allSettled
is undefined when Sentry is enabled in the appSteps to reproduce:
Promise.allSettled
function in any part of the appSentry.init
code)Promise.allSettled
function in any part of the appActual result:
error "Promise.allSettled is not a function"
Expected result:
The function works as expected
Minimal Reproducible Example I created a new project with Expo and added Sentry using the Wizard. Check the readme to reproduce the issue https://github.com/ignaciosantise/sentry-issue
Screenshots
Sentry enabled
https://github.com/user-attachments/assets/29427948-19ed-4260-b5a4-68994c55161f
Sentry disabled
https://github.com/user-attachments/assets/af4502b6-0d8c-4558-b404-014ac1be6c49