Skip to main content
Question

React native expo there is no singleton instance error

  • January 28, 2025
  • 1 reply
  • 25 views

Forum|alt.badge.img+1

Hello
I am developing an application with React Native Expo, but I am getting the error below. My configurations are complete, I was able to pull the products before and made the purchase.

 

 LOG  Error fetching products:  [Error: There is no singleton instance. Make sure you configure Purchases before trying to get the default instance. More info here: https://errors.rev.cat/configuring-sdk]

 

React.useEffect(() => {

        Purchases.isConfigured().then((configured) => {

            if (!configured) {
                const resp = Purchases.configure({ apiKey: Platform.OS == "android" ? "goo******" : "ap/***********n" });
                console.log("resp",resp) //undefined 
            } else {
                fetchProducts()
            }
        })

    }, []);

    const fetchProducts = async () => {
        try {
            const offerings = await Purchases.getOfferings();

            const availableProducts = offerings.current?.availablePackages;
            setProducts(availableProducts || []);
        } catch (error) {
            console.log("Error fetching products: ", error);
        }
    };

 

This post has been closed for comments

1 reply

joan-cardona
RevenueCat Staff
Forum|alt.badge.img+6
  • RevenueCat Staff
  • 313 replies
  • January 30, 2025

Hi ​@tunayangir,

If the SDK is configured at that point, would you mind checking in which version of the SDK are you seeing it? We recently introduced a fix for a very similar issue and it’s available in v8.5.1.

Let me know if that helps!


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