RevenueCat / RevenueCat/react-native-purchases
App needs to be restarted to identify user
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.2k
- Forks
- 117
- Avg merge
- 14h 40m
- Merged PRs (30d)
- 40
Description
- 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
I have lost about 500 paying subscribers because revenuecat is failing to identify my paying users. This started happening after upgrading the library.
For a subscribed user to access their premium features after log in they will need to kill and restart the app.
This is my validateSub function - what am I doing wrong?
export const validateSubscription = () => {
return (dispatch: Dispatch) => {
auth().onAuthStateChanged(async (currentUser) => {
if (!currentUser) {
return;
}
const user = await Purchases.logIn(currentUser.uid);
const isSubscriptionActive =
typeof user.customerInfo.entitlements.active.plus !==
'undefined';
if (isSubscriptionActive) {
prettyLog("auth().onAuthStateChanged - You're a PLUS user!");
return dispatch({ type: SUBSCRIPTION_VALIDATED });
}
});
Purchases.addCustomerInfoUpdateListener(
async (updatedCustomerInfo) => {
if (
typeof updatedCustomerInfo.entitlements.active?.plus !==
'undefined'
) {
return dispatch({ type: SUBSCRIPTION_VALIDATED });
}
dispatch({ type: SUBSCRIPTION_EXPIRED });
},
);
};
};
I am calling Purchases.configure outside my App.js (very early)
Sometimes the user within the addCustomerInfoUpdateListener will return a non-subbed user while the user inside the onAuthStateChanged IS subscribed. This is really confusing an non-intuitive.
I dont know what else to try and dont want to ship another version and lose whats left.
Please help.
- Environment
- Platform: iOS and android
- SDK version: 6.3.0
- OS version:
- Xcode/Android Studio version:
- React Native version: 0.72.1
- SDK installation (CocoaPods + version or manual):
- How widespread is the issue. Percentage of devices affected. Almost everyone.
- Debug logs that reproduce the issue
- 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
Add any other context about the problem here.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start from the reported validateSubscription flow and the Purchases SDK 6.3.0 behavior, then review the linked debugging documentation and reproduce the listener-ordering discrepancy on iOS and Android. Done means identifying why the two callbacks report different subscription states and documenting or implementing a reliable fix with reproduction evidence.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- firebase, react-native, typescript
- Domain
- authentication, mobile, payments
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100