Solved

unable to track error in React Native

  • 21 July 2021
  • 3 replies
  • 93 views

Badge

I’m following the supplied examples and was able to list packages and buy one product. Although the process do not reach the end because of a raised error, but the error is very general, and not clear at all. Also it does not have any error code as it was supposed to according to the docs here (https://docs.revenuecat.com/docs/errors#android-errors).

My Code:

try {
const offerings = await Purchases.getOfferings();
if (offerings.current.lifetime !== null) {
const currentOffering = offerings.current.lifetime;
const { purchaserInfo, productIdentifier } = await Purchases.purchasePackage(currentOffering);

if (typeof purchaserInfo.entitlements.active[ENTITLEMENT_ID] !== 'undefined') {
console.log("Purchase Success");
}
}
} catch (e) {
if (!e.userCancelled) {
console.log(e);
}
}

Let me be clear that the native android purchase popup is correctly shown int the device (real device, not simulator), and the process is succeed by Google.

The error object returned is simply this:

[Error: There is an issue with your configuration. Check the underlying error for more details.]

Is this object not missing an error code?

Thank you.

icon

Best answer by sharif 21 July 2021, 03:05

View original

3 replies

Userlevel 3
Badge +8

There should be a little more to that error - would it be possible to copy/paste or attach the full debug logs here? You may have to launch your app from Android Studio and check the Logcat tab at the bottom.

Just going based off of that generic error and the fact you’re running on Android, I would make sure that the package name of your app is the same in Google Play Console, RevenueCat dashboard, and Android Studio/React Native. The package name of your app is used to verify purchases with Google, so it needs to be the same everywhere. Take a look at Google’s docs for more information on setting an Android app's package name.

Userlevel 3
Badge +8

This came up in our team and @sundeep  had the idea to JSON.stringify the error object, which may provide more info than that generic message (so something like console.log(JSON.stringify(e))) rather than just console.log(e)).

Badge

Hi, and thank you so much for both the replies.

The 

JSON.Stringify(e)

really helped.

here is the full object:

{
"nativeStackAndroid": [

],
"userInfo": {
"userCancelled": false,
"code": 22,
"underlyingErrorMessage": "Invalid package name.",
"readableErrorCode": "ConfigurationError",
"readable_error_code": "ConfigurationError",
"message": "There is an issue with your configuration. Check the underlying error for more details."
},
"message": "There is an issue with your configuration. Check the underlying error for more details.",
"code": "22",
"userCancelled": false,
"line": 4524,
"column": 45,
"sourceURL": "http://localhost:8081/index.bundle?platform=android&dev=true&minify=false"
}

And you were right, I had a typo in the package name entered in the RC dashboard.

I corrected that, tried a new purchase and it worked.

Thanks :thumbsup: .

Reply