Skip to main content

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 || s]);
} catch (error) {
console.log("Error fetching products: ", error);
}
};

 

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!


Reply