dooboolab-community / react-native-iap

In App Purchase module for React Native!
https://react-native-iap.dooboolab.com
MIT License
2.82k stars 643 forks source link

Error when trying to fetch Amazon App User ID using react-native-iap #2513

Open mansilaad19 opened 1 year ago

mansilaad19 commented 1 year ago

Hello maintainers and community,

I'm using the react-native-iap package version 12.10.5 for my React Native application on Fire TV. I'm trying to fetch the Amazon App User ID using the following code:

let userObj = await RNIap.IapAmazon.AmazonModule.getUser();

However, I'm encountering an error with the message "Error not specified". Below is the detailed error stack:

Possible Unhandled Promise Rejection (id: 1): Error: Error not specified. Error: Error not specified. at promiseMethodWrapper (http://192.168.2.91:8081/index.bundle//&platform=android&dev=true&minify=false&app=com.travelxp.firetv&modulesOnly=false&runModule=true:1678:45) at ?anon_0_ (http://192.168.2.91:8081/app/views/subscription.bundle//&platform=android&app=com.travelxp.firetv&modulesOnly=true&dev=true&minify=false&runModule=true&shallow=true:225:67) at next (native) at asyncGeneratorStep (http://192.168.2.91:8081/index.bundle//&platform=android&dev=true&minify=false&app=com.travelxp.firetv&modulesOnly=false&runModule=true:20290:26) at _next (http://192.168.2.91:8081/index.bundle//&platform=android&dev=true&minify=false&app=com.travelxp.firetv&modulesOnly=false&runModule=true:20309:29) at anonymous (http://192.168.2.91:8081/index.bundle//&platform=android&dev=true&minify=false&app=com.travelxp.firetv&modulesOnly=false&runModule=true:20314:14) at tryCallTwo (/Users/dlowder/iosProjects/react-native-tvos/ReactAndroid/hermes-engine/.cxx/Release/604k1y5k/armeabi-v7a/lib/InternalBytecode/InternalBytecode.js:61:9) at doResolve (/Users/dlowder/iosProjects/react-native-tvos/ReactAndroid/hermes-engine/.cxx/Release/604k1y5k/armeabi-v7a/lib/InternalBytecode/InternalBytecode.js:216:25) at Promise (/Users/dlowder/iosProjects/react-native-tvos/ReactAndroid/hermes-engine/.cxx/Release/604k1y5k/armeabi-v7a/lib/InternalBytecode/InternalBytecode.js:82:14) at anonymous (http://192.168.2.91:8081/index.bundle//&platform=android&dev=true&minify=false&app=com.travelxp.firetv&modulesOnly=false&runModule=true:20306:25) at apply (native) at checkValidSubscription (http://192.168.2.91:8081/app/views/subscription.bundle//&platform=android&app=com.travelxp.firetv&modulesOnly=true&dev=true&minify=false&runModule=true&shallow=true:262:47) at ?anon_0_ (http://192.168.2.91:8081/app/views/subscription.bundle//&platform=android&app=com.travelxp.firetv&modulesOnly=true&dev=true&minify=false&runModule=true&shallow=true:129:40) at next (native) at asyncGeneratorStep (http://192.168.2.91:8081/index.bundle//&platform=android&dev=true&minify=false&app=com.travelxp.firetv&modulesOnly=false&runModule=true:20290:26) at _next (http://192.168.2.91:8081/index.bundle//&platform=android&dev=true&minify=false&app=com.travelxp.firetv&modulesOnly=false&runModule=true:20309:29) at tryCallOne (/Users/dlowder/iosProjects/react-native-tvos/ReactAndroid/hermes-engine/.cxx/Release/604k1y5k/armeabi-v7a/lib/InternalBytecode/InternalBytecode.js:53:16) at anonymous (/Users/dlowder/iosProjects/react-native-tvos/ReactAndroid/hermes-engine/.cxx/Release/604k1y5k/armeabi-v7a/lib/InternalBytecode/InternalBytecode.js:139:27) at apply (native) at anonymous (http://192.168.2.91:8081/index.bundle//&platform=android&dev=true&minify=false&app=com.travelxp.firetv&modulesOnly=false&runModule=true:25934:26) at _callTimer (http://192.168.2.91:8081/index.bundle//&platform=android&dev=true&minify=false&app=com.travelxp.firetv&modulesOnly=false&runModule=true:25853:17) at _callReactNativeMicrotasksPass (http://192.168.2.91:8081/index.bundle//&platform=android&dev=true&minify=false&app=com.travelxp.firetv&modulesOnly=false&runModule=true:25883:17) at callReactNativeMicrotasks (http://192.168.2.91:8081/index.bundle//&platform=android&dev=true&minify=false&app=com.travelxp.firetv&modulesOnly=false&runModule=true:26046:44) at __callReactNativeMicrotasks (http://192.168.2.91:8081/index.bundle//&platform=android&dev=true&minify=false&app=com.travelxp.firetv&modulesOnly=false&runModule=true:2076:46) at anonymous (http://192.168.2.91:8081/index.bundle//&platform=android&dev=true&minify=false&app=com.travelxp.firetv&modulesOnly=false&runModule=true:1888:45) at __guard (http://192.168.2.91:8081/index.bundle//&platform=android&dev=true&minify=false&app=com.travelxp.firetv&modulesOnly=false&runModule=true:2060:15) at flushedQueue (http://192.168.2.91:8081/index.bundle//&platform=android&dev=true&minify=false&app=com.travelxp.firetv&modulesOnly=false&runModule=true:1887:21) at invokeCallbackAndReturnFlushedQueue (http://192.168.2.91:8081/index.bundle//&platform=android&dev=true&minify=false&app=com.travelxp.firetv&modulesOnly=false&runModule=true:1881:33)

Expected Behavior

The method should return the Amazon App User ID without any errors.

Actual Behavior

An error with the message "Error not specified" is thrown.

Environment:

To Reproduce Steps to reproduce the behavior:

  1. Initialize the react-native-iap package.
  2. Call the RNIap.IapAmazon.AmazonModule.getUser() method.
  3. Observe the error.

    Additional Context I've followed the setup instructions for the react-native-iap package correctly, especially for the Amazon platform. I've checked my Amazon Developer account setup and ensured that I have the necessary permissions.

Output of npx react-native info info Fetching system and libraries information... System: OS: macOS 13.4.1 CPU: (6) x64 Intel(R) Core(TM) i5-8500B CPU @ 3.00GHz Memory: 17.88 MB / 16.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 18.12.1 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 8.19.2 - /usr/local/bin/npm Watchman: Not Found Managers: CocoaPods: 1.12.1 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4 Android SDK: Not Found IDEs: Android Studio: 2022.3 AI-223.8836.35.2231.10406996 Xcode: 14.3.1/14E300c - /usr/bin/xcodebuild Languages: Java: 11.0.19 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.2.0 => 18.2.0 react-native: Not Found react-native-macos: Not Found react-native-tvos: 0.69.6-0 npmGlobalPackages: react-native: Not Found

I'd appreciate any help or insights into resolving this issue. Thank you!

mansilaad19 commented 1 year ago

@hyochan ,@andresesfm and @JJMoon Could you please help me here.

andresesfm commented 1 year ago

Wrap it in a try-catch

mansilaad19 commented 1 year ago

Already did that, my code is - try{ let userId = (await RNIap.IapAmazon.AmazonModule.getUser()).userIdAmazon; } catch(error){ console.log("Error fetching Amazon user:", error); }

Error is - Error: Error not specified

I'd appreciate any help or insights into resolving this issue. Thank you!