Skip to main content
Question

Purchases.getOfferings() randomly fails in Prod

  • March 3, 2024
  • 2 replies
  • 151 views

Forum|alt.badge.img+8

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

wes_clark
RevenueCat Staff
Forum|alt.badge.img+6
  • RevenueCat Staff
  • March 6, 2024

​​​​​ 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

 


Forum|alt.badge.img+8
  • Author
  • Helper
  • March 6, 2024

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.