Closed clauxx closed 1 year ago
👀 SDKONCALL-238 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out!
Thanks for the detailed report! Looks like there's a lot of Firebase noise, it seems to be intercepting some Objective-C calls. Are you able to reproduce this issue if you disable Firebase?
@NachoSoto i tried this solution but it is not working
i use storeKit1 as storeKit2 rejected from apple as purchase package return receipt is missing
Ahh didn't realize there was a react-native-purchase issue already open about this. We are having the same issue and I posted about it in the purchases-ios project of a similar issue.
Ours is with Purchases.purchaseProduct and the function call hangs because the function promise never resolves. However, its inconsistent. This is how we are using it, when it hangs the catch and finally block never run. But we it runs successfully they do. So something weird about the error handler? Or maybe retry logic?
async function purchaseFanSubscription(vars: PurchaseSubscriptionVariables) {
if (!offeringQuery.data) {
console.warn(
'Tried to purchase fan subscription before offerings data was loaded. Ensure that the data is loaded on the component level before calling purhcaseFanSubscription.',
)
return
}
await Purchases.purchaseProduct(vars.productId)
.catch((err) => {
console.log(err)
console.log('caught an error in the purchase product call')
})
.finally(async () => {
console.log('finally is running')
await forceTokenRefresh()
await invalidateIapUserInfoQuery()
})
// Token should now have up to date account information
}
We did come up with a work around for now and Im sure it can be adapted for the original issue. But it seems like even though it hangs it still makes the purchase. So we used a setInterval and polled the customer info looking for our product and then returned after that or if the call is successful just use the actually successfully resolved promise.
async function purchaseFanSubscription(vars: PurchaseSubscriptionVariables) {
// return new Promise<void>()
if (!offeringQuery.data) {
console.warn(
'Tried to purchase fan subscription before offerings data was loaded. Ensure that the data is loaded on the component level before calling purhcaseFanSubscription.',
)
return
}
const customerInfoCheck = setInterval(async () => {
const customerInfo = await Purchases.getCustomerInfo()
if (
customerInfo.activeSubscriptions.find((it) => it === vars.productId)
) {
console.log(
'purchaseFanSubscription customerInfoCheck found product id during a hang',
)
clearInterval(customerInfoCheck)
await forceTokenRefresh()
await invalidateIapUserInfoQuery()
return
}
}, 2000)
await Purchases.purchaseProduct(vars.productId)
.finally(async () => {
console.log('finally is running')
clearInterval(customerInfoCheck)
await forceTokenRefresh()
await invalidateIapUserInfoQuery()
})
// Token should now have up to date account information
}
Thanks for the detailed report! Looks like there's a lot of Firebase noise, it seems to be intercepting some Objective-C calls. Are you able to reproduce this issue if you disable Firebase?
Yes, it still persists.
Is there a chance you could stop the app with Xcode's debugger when this happens to see if there's any thread blocked?
@NachoSoto so straange, it worked now in the sandbox. With a bit of a delay (a few seconds), but the promise was resolved. Please don't close the issue though, cause it still seems like our users have this problem.
We are evaluating for the first time and are definitely seeing Purchases.purchaseProduct never resolving regardless of the purchase actually being successful(The sandbox success alert) and customer info being updated.
const purchase = await Purchases.purchasePackage(aPackage)
console.log('never gets called')
If I understand correctly, the current hypothesis is that it's to do with DeviceCache? I'm not sure whether it's related but also activeSubscriptions required a force close of the app to be removed from active subscriptions regardless of calls to Purchases.getCustomerInfo
.
Happy to try out a new version of purchases-ios to validate things are working our end.
@NachoSoto are there any updates on this from your side?
I'm going to be releasing an update to the react-native-purchases
in a bit with the latest version of purchases-ios
that includes https://github.com/RevenueCat/purchases-ios/pull/2375
I'll let you know when it's out so you can test it since it might fix your issue 👍🏻
Version 5.13.2 is out. Could you test with that and let us know if you can still reproduce this? 🙏🏻
I have the same issue but with purchases-ios. After calling Purchases.shared.purchase(package: product) { (transaction, customerInfo, error, userCancelled) in
the callback never gets executed but it does purchase the product successfully.
Purchases.shared.purchase(package: product) { (transaction, customerInfo, error, userCancelled) in
// This is never called
unlockPro = true
}
For those that ran into this issue: could you confirm that you had code inside of your Purchases.addCustomerInfoUpdateListener
that called Purchases.getCustomerInfo
? That would have led to a deadlock, and it will be fixed in the next released: https://github.com/RevenueCat/purchases-ios/pull/2412
Hi, I am still getting this issue in version 7.0.0. Not getting a response even though the product is purchased successfully. Works fine for in app products but not for subscriptions. This is in android. Any ideas on how to move forward? This is very integral. Any help would really be appreciated!
the same problem still persists. any solution?
@NachoSoto Seems like many others continue to get this issue, I am on version 6.7.0 and having the same problem still on android.
It'd be really helpful if you could open a new issue providing all the data we need: logs, code, platform versions, etc.
Description Starting with March the 6th, the
Purchases.purchasePackage
promise is neither resolved nor rejected. The purchases are going through from what we see in the dashboard, but the tracking we do whenever the promise is resolved never fires. The same behavior is observed in the sandbox environment, where the promise is not resolved/rejected. I noticed a similar bug mentioned in other issues, so wonder if that could be related.iOS/Android
5.12.0
16.0
XCode 14.1
0.67.5
Expected The
purchasePackage
promise resolves/rejects. The purchase is successful and appears in the Dashboard.Actual The
purchasePackage
never resumes execution. No errors are thrown and the value is never resolved. The purchase is still successful and appears in the Dashboard, we just don't know about it in the app.