Purchase Package Error in React Native
When attempting to make a purchase using RevenueCat's purchasePackage method, the app throws a "Malformed calls from JS" error with a TypeError indicating properties are not configurable.
Environment
- React Native version: 0.74.5
- RevenueCat SDK version: 8.2.4, 8.2.5 also show this error
- Expo version (if applicable): ~51.0.38
- Platform: iOS
- Device: iPhone 14 Pro and iOS Simulator
- OS version: iOS 17.1.1
Steps to Reproduce
- Select a package for purchase
- Call
Purchases.purchasePackage(package) - Error occurs during the purchase process
Code example
typescript
try {
const purchaseResult = await RevenueCat.purchasePackage(selectedPackage);
return purchaseResult;
} catch (error) {
console.log("Error during purchase:", error);
throw error;
}
Error Log
iOS Bundled 277ms node_modules/expo-router/entry.js (1 module)
ERROR Error: Exception in HostFunction: Malformed calls from JS: field sizes are different.
[[9,77,77,79,79,56],[7,0,1,1,1,3],[[500,100,1730706566431,false],[500],["{\"type\":\"log\",\"level\":\"error\",\"mode\":\"BRIDGE\",\"data\":[\"Failed to purchase package:\",\"[TypeError: property is not configurable]\"]}",1],["{\"type\":\"log\",\"level\":\"log\",\"mode\":\"BRIDGE\",\"data\":[\"Error during purchase:\",\"[TypeError: property is not configurable]\"]}",1],[2967,"RCTRawText",1,{"text":""}]],2569]
This error is located at:
in RCTText (created by Text)
in Text (created by Icon)
in Icon (created by Icon)
in Icon
in NativeWind.Icon
in NativeWind.NoName
in Unknown (created by MenuItem)
in RCTView (created by View)
in View
in NativeWind.View
in NativeWind.NoName
in Unknown (created by MenuItem)
in RCTView (created by View)
in View
in NativeWind.View
in NativeWind.NoName
in Unknown (created by SlotClone)
in SlotClone (created by Slot)
in Slot
in ExpoRouterLink (created by MenuItem)
in RCTView (created by View)
in View (created by Pressable)
in Pressable (created by Pressable)
in MenuItem
in RCTView (created by View)
in View
in NativeWind.View
in RCTView (created by View)
in View
in NativeWind.View
in NativeWind.NoName
in Unknown
in RCTView (created by View)
in View
in NativeWind.View
in NativeWind.NoName
in Unknown
in RCTScrollContentView (created by ScrollView)
in RCTScrollView (created by ScrollView)
in ScrollView (created by ScrollView)
in ScrollView
in NativeWind.ScrollView
in NativeWind.NoName
in Unknown
in RCTView (created by View)
in View
in NativeWind.View
in NativeWind.NoName
in Unknown
in Unknown
in Unknown (created by Route(profile))
in Suspense (created by Route(profile))
in Route (created by Route(profile))
in Route(profile) (created by SceneView)
in StaticContainer
in EnsureSingleNavigator (created by SceneView)
in SceneView (created by SceneView)
in RCTView (created by View)
in View (created by DebugContainer)
in RCTView (created by View)
in View (created by AppContainer)
in RCTView (created by View)
in View (created by AppContainer)
in AppContainer (created by DebugContainer)
in DebugContainer (created by MaybeNestedStack)
in MaybeNestedStack (created by SceneView)
in RCTView (created by View)
in View (created by SceneView)
in RNSModalScreen (created by Animated(Anonymous))
in Animated(Anonymous) (created by InnerScreen)
in Suspender (created by Freeze)
in Suspense (created by Freeze)
in Freeze (created by DelayedFreeze)
in DelayedFreeze (created by InnerScreen)
in InnerScreen (created by Screen)
in Screen (created by SceneView)
in SceneView (created by NativeStackViewInner)
- [x] I have updated Purchases SDK to the latest version
- [x] I have read the Contribution Guidelines
- [x] I have searched the Community
- [x] I have read docs.revenuecat.com
- [x] I have searched for existing Github issues
👀 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out!
I just started a brand new integration. I'm seeing this on Android as well. On iOS I was able to use purchaseStoreProduct and that worked. But Android still exhibits the error. getOfferings and getCustomerInfo seem to work just fine. For now I have one package with one product in it per platform that is consumable. I have only tried this on physical devices with debug builds, no simulators or release builds.
- React Native v0.74.2
- Pixel 8 Android 14.0 API 34
- iPhone 16 Pro iOS 18.1
Any workaround? Obviously this is a blocker...
Update: I've installed all the way back to v7.28.1 of this package (SDK version 7.12.0 on Android) and the error still occurs.
Hi, apologies for the delay. You will want to make sure that you are passing the correct arguments into purchaseProduct and purchasePackage. For getPackage you should make sure to pass a PurchasesPackage. Here it looks like you might be passing a RCTRawText, can you confirm you are passing a PurchasesStoreProduct or a PurchasesStorePackage
I am facing an issue with RevenueCat's purchaseStoreProduct method on Android. While it works correctly on iOS, attempting to use it on Android results in a Malformed calls from JS: field sizes are different error.
Environment React Native version: 0.74.3 RevenueCat SDK version: 8.8.0, 8.9.1 Platform: Android Device: Samsung Fold , Google Pixel 6
Code Snippet
const offerings = await Purchases.getOfferings();
// Extracting product from the offerings and passing it into the purchaseStoreProduct method
const purchaseResponse = await Purchases.purchaseStoreProduct(product);
Observations
- getOfferings() and getCustomerInfo() work fine on both iOS and Android.
- Only purchaseStoreProduct(product) fails on Android.
- The same code functions as expected on iOS.
Error Message (Android)
Error: Exception in HostFunction: Malformed calls from JS: field sizes are different.
[[92,37,37,11,52,3],[16,0,1,0,5,2],[[1221,100,1743596138339,false],[1221],[{"message":"TypeError: property is not configurable","level":"debug","category":"console","data":{"logger":"console","arguments":[{"userCancelled":false,"stack":"TypeError: property is not configurable\n at defineProperty (native)\n at defineProperty_ (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.payment.app&modulesOnly=false&runModule=true:205072:25)\n at defineProperty (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.payment.app&modulesOnly=false&runModule=true:203528:69)\n at defineProperty (native)\n at deepFreezeAndThrowOnMutationInDev (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.payment.app&modulesOnly=false&runModule=true:2596:32)\n at deepFreezeAndThrowOnMutationInDev (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.payment.app&modulesOnly=false&runModule=true:2606:44)\n at enqueueNativeCall (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.payment.app&modulesOnly=false&runModule=true:2079:91)\n at anonymous (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.payment.app&modulesOnly=false&runModule=true:3634:78)\n at tryCallTwo (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.payment.app&modulesOnly=false&runModule=true:36622:9)\n at doResolve (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.payment.app&modulesOnly=false&runModule=true:36761:25)\n at Promise (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.payment.app&modulesOnly=false&runModule=true:36641:14)\n at promiseMethodWrapper (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.payment.app&modulesOnly=false&runModule=true:3633:27)\n at anonymous (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.payment.app&modulesOnly=false&runModule=true:330988:64)\n at call (native)\n at step (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.payment.app&modulesOnly=false&runModule=true:330616:23)\n at anonymous (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.payment.app&modulesOnly=false&runModule=true:330565:20)\n at fulfilled (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.payment.app&modulesOnly=false&runModule=true:330524:30)\n at tryCallOne (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.payment.app&modulesOnly=false&runModule=true:36614:16)\n at anonymous (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.payment.app&modulesOnly=false&runModule=true:36695:27)\n at apply (native)\n at anonymous (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.payment.app&modulesOnly=false&runModule=true:38079:26)\n at _callTimer (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.payment.app&modulesOnly=false&runModule=true:37958:17)\n at _callReactNativeMicrotasksPass (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.payment.app&modulesOnly=false&runModule=true:38003:17)\n at callReactNativeMicrotasks (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.payment.app&modulesOnly=false&runModule=true:38209:44)\n at __callReactNativeMicrotasks (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.payment.app&modulesOnly=false&runModule=true:2163:48)\n at anonymous (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.payment.app&modulesOnly=false&runModule=true:1936:45)\n at __guard (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.payment.app&modulesOnly=false&runModule=true:2135:15)\n at flushedQueue (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.payment.app&modulesOnly=false&runModule=true:1935:21)\n at invokeCallbackAndReturnFlushedQueue (http://localhost:8081/index.bundle//&platform=android&dev=true&lazy=true&minify=false&app=com.payment.app&modulesOnly=false&runModule=true:1929:33)","name":"TypeError","message":"property is not configurable"}]},"timestamp":1743596138.339}],["{\"type\":\"log\",\"level\":\"log\",\"mode\":\"BRIDGE\",\"data\":[\"[TypeError: property is not configurable]\"]}",1],[4175,"RCTView",11,{"marginBottom":12.631836734693879}]],7501]
Additionally, the logs show
TypeError: property is not configurable