Skip to main content
Question

Purchases.getOfferings() randomly fails in Prod


Forum|alt.badge.img+7

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

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+7
  • Dedicated Member
  • 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.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings