react-native-purchases: Purchases.getProducts() hangs
- I have updated Purchases SDK to the latest version
- I have read the Contribution Guidelines
- I have searched the Community
- I have read docs.revenuecat.com
- I have searched for existing Github issues
Describe the bug A clear and concise description of what the bug is. The more detail you can provide the faster our team will be able to triage and resolve the issue. Do not remove any of the steps from the template below. If a step is not applicable to your issue, please leave that step empty.
- Environment
- Platform: Android
- SDK version: 7.27.0
- OS version: 14.4 (23E214)
- Xcode/Android Studio version: 2023.1.1 Patch 1
- React Native version: 0.73.6
- SDK installation (CocoaPods + version or manual): Expo 50.0.17
- How widespread is the issue. Percentage of devices affected. 100%, both simulator and real Android device
- Debug logs that reproduce the issue: Same as https://github.com/RevenueCat/react-native-purchases/issues/832 I’ve set Purchases.setLogLevel(Purchases.LOG_LEVEL.DEBUG); but nothing’s ever actually logged (ongoing issue seemingly unrelated)
- Steps to reproduce, with a description of expected vs. actual behavior
- Other information (e.g. stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, etc.)
Additional context I had a purchase in February and haven’t changed anything in RevenueCat or the Play Store since then so it’s seemingly something code
Purchases.setLogLevel(Purchases.LOG_LEVEL.DEBUG); // Doesn't seem to do anything
if (Platform.OS == "android") {
console.log(' Android', Constants.expoConfig.extra.revenueCatGoogleApiKey, anonymousUserId);
Purchases.configure({ apiKey: Constants.expoConfig.extra.revenueCatGoogleApiKey, appUserID: anonymousUserId });
} else {
console.log(' Apple', Constants.expoConfig.extra.revenueCatAppleApiKey, anonymousUserId);
Purchases.configure({ apiKey: Constants.expoConfig.extra.revenueCatAppleApiKey, appUserID: anonymousUserId });
}
// Above console.log's output correctly
const productIds = Object.values(Constants.expoConfig.extra.products[Platform.OS]);
console.log('Fetching products with IDs:', productIds); // Output's correctly (also works in iOS)
try {
const products = await Purchases.getProducts(productIds); // Hangs?
console.log('Products fetched:', products); // Never logs
setProducts(products);
} catch (error) { // Nothing ever happens here either
console.error('Failed to get products', error);
Sentry.captureException(error);
}
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 1
- Comments: 16 (6 by maintainers)
I noticed that for Android, I have to use the value up to the
:instead of the full path of the Products to get it.For example Pass “premium-plan” to getProducts instead of “premium-plan:1month”.