Question

Purchases.getOfferings() randomly fails in Prod

  • 3 March 2024
  • 2 replies
  • 20 views

Badge +6

I wrap my app with BugSnag to capture errors.  It’s not entirely uncommon to have errors with the `Purchases` API from RevenueCat.  For example, just today:

 


You can see the error is `Error performing Request` which comes from my code block:
 


useEffect(
function offerings() {
async function getOfferings() {
try {
if (!paywallEligible) return;

const offerings = await Purchases.getOfferings();
if (offerings.current?.availablePackages.length) {
setOfferings(offerings);
setActivePkg(offerings.current?.availablePackages[0]);
}
} catch (e) {
setMessage(['error', 'Error retrieving products.']);
Bugsnag.notify({
name: 'getOfferings Error in Paywall',
message: (e as Error).message,
});
console.error(e);
} finally {
setIsLoading(false);
}
}

if (!isReady) return;
getOfferings();
},
[setMessage, isReady]
);

Because this is happening on the paywall, the user is not logged in.

Is there anything I am doing incorrectly?  


This post has been closed for comments

2 replies

Userlevel 3
Badge +5

​​​​​ Hi! Are able to capture the debug logs that reproduce this? You can enable debug logs by following this guide. After they're enabled you'll see logs like this in the console:

[Purchases] - DEBUG: No cached entitlements, fetching
[Purchases] - DEBUG: GET /v1/subscribers/<APP_USER_ID> 200
[Purchases] - DEBUG: Purchaser info updated, sending to delegate

 

Badge +6

Once again, no errors locally.  These are always in production.  I try to capture the error itself, as you can see, and log that error, which is what surfaces in BugSnag.