Skip to content
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

Promise.allSettled undefined on iOS and Android using Hermes #1476

Closed
ammar-madni opened this issue Aug 16, 2024 · 4 comments
Closed

Promise.allSettled undefined on iOS and Android using Hermes #1476

ammar-madni opened this issue Aug 16, 2024 · 4 comments

Comments

@ammar-madni
Copy link

Description

Our Sentry logs are showing multiple error events when calling Promise.allSettled with the error being undefined is not a function.

I can't replicate the issue locally, only seems to happen in production.

facebook/react-native#35363

Steps to reproduce

1.- Setup a blank react native app.
2.- Use Promise.allSettled.
3.- Build the app for production.
4.- Get [TypeError: undefined is not a function].

React Native Version

0.74.5

Affected Platforms

Runtime - Android, Runtime - iOS

Output of npx react-native info

System:
  OS: macOS 14.5
  CPU: (10) arm64 Apple M1 Max
  Memory: 111.30 MB / 64.00 GB
  Shell: Unknown
Binaries:
  Node:
    version: 18.20.3
    path: ~/.local/state/fnm_multishells/91817_1721590401131/bin/node
  Yarn:
    version: 1.22.19
    path: /usr/local/bin/yarn
  npm:
    version: 10.7.0
    path: ~/.local/state/fnm_multishells/91817_1721590401131/bin/npm
  Watchman:
    version: 2024.05.06.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.5
      - iOS 17.5
      - macOS 14.5
      - tvOS 17.5
      - visionOS 1.2
      - watchOS 10.5
  Android SDK: Not Found
IDEs:
  Android Studio: 2024.1 AI-241.18034.62.2411.12071903
  Xcode:
    version: 15.4/15F31d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.10
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.74.5
    wanted: 0.74.5
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Stacktrace or Logs

TypeError: undefined is not a function
  at refetchAll(/src/app/bookings/[id]/edit.tsx:103:34)
  at fetchData(/src/utils/hooks/useUserInitiatedFetch.ts:9:20)
  at next(native)
  at asyncGeneratorStep(/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:17)
  at _next(/node_modules/@babel/runtime/helpers/asyncToGenerator.js:17:27)
  at Promise$argument_0(/node_modules/@babel/runtime/helpers/asyncToGenerator.js:22:12)
  at tryCallTwo(/node_modules/promise/setimmediate/core.js:45:7)
  at doResolve(/node_modules/promise/setimmediate/core.js:200:23)
  at Promise(/node_modules/promise/setimmediate/core.js:66:12)
  at <anonymous>(/node_modules/@babel/runtime/helpers/asyncToGenerator.js:14:23)
  at _onRefresh(/node_modules/react-native/Libraries/Components/RefreshControl/RefreshControl.js:187:49)
  at apply(native)
  at invokeGuardedCallbackImpl(/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:22:15)
  at apply(native)
  at invokeGuardedCallback(/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:40:34)
  at apply(native)
  at invokeGuardedCallbackAndCatchFirstError(/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:53:30)
  at executeDispatch(/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:73:42)
  at executeDispatchesAndReleaseTopLevel(/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:1047:24)
  at call(native)
  at forEachAccumulated(/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:364:63)
  at batchedUpdates$1$argument_0(/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:1082:25)
  at batchedUpdatesImpl(/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:9578:14)
  at batchedUpdates$1(/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:1028:30)
  at _receiveRootNodeIDEvent(/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:1059:19)
  at ReactNativePrivateInterface.RCTEventEmitter.register$argument_0.receiveEvent(/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:1102:28)
  at apply(native)
  at __callFunction(/node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:433:34)
  at __guard$argument_0(/node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:113:26)
  at __guard(/node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:368:11)
  at callFunctionReturnFlushedQueue(/node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:112:17)

Reproducer

https://github.com/ammar-madni/promise-all-settled-undefined

Screenshots and Videos

Screenshot 2024-08-16 at 10 02 10
@cortinico
Copy link
Contributor

Passing over to the hermes team

@tmikov
Copy link
Contributor

tmikov commented Aug 16, 2024

Hi, we are unable to investigate problems without a minimal repro, plus this doesn't look like a bug in Hermes - Hermes exposes Promise.allSettled().

However from a cursory glance it looks like you are using a Promise polyfill, not the Promise provided by Hermes, judging by the following lines in your stack trace:

  at tryCallTwo(/node_modules/promise/setimmediate/core.js:45:7)
  at doResolve(/node_modules/promise/setimmediate/core.js:200:23)
  at Promise(/node_modules/promise/setimmediate/core.js:66:12)

@tmikov tmikov closed this as not planned Won't fix, can't repro, duplicate, stale Aug 16, 2024
@ammar-madni
Copy link
Author

The polyfill is from react-native and react-native-web.

my-app@1.0.0 /Users/ammar/Code/my-app
├─┬ react-native-web@0.19.12
│ └─┬ fbjs@3.0.5
│   └── promise@7.3.1
└─┬ react-native@0.74.5
  └── promise@8.3.0

@tmikov
Copy link
Contributor

tmikov commented Oct 8, 2024

@ammar-madni Thank you for confirming. Since this is not the Promise implementation provided by Hermes, we can't really help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants