Skip to main content

Hi,

I will try to do my best but this issue is pretty weird but yet, REALLY important. It's related to https://github.com/RevenueCat/react-native-purchases/issues/777 and https://github.com/RevenueCat/react-native-purchases/issues/627
Sometimes, for a reason I don't understand, the `login` and `setEmail`/`setPhoneNumber`/`setUserName` functions seem doing nothing. This results in unidentified users that have subscriptions not linked to our backend because the `app_user_id` will be the anonymous one and not the custom one we are using.
Then, when the app is killed and opened again, the functions will work correctly (sometimes yes, sometimes no).

My login function is pretty simple : 
 

const login = async (token) => {
                updateAuthToken(token);
                await storeAuthCookie(token);
                const user = await fetchUser();
                await Purchases.logIn(user.id.toString());
                await Purchases.setEmail(user.email);
                await Purchases.setPhoneNumber(user.principalPhone);
                await Purchases.setDisplayName(`${user.firstName} ${user.lastName}`);
}

When the app is launched, this `useEffect` is called : 
 

useEffect(() => {
        Purchases.setLogLevel(Purchases.LOG_LEVEL.DEBUG);
        if (Platform.OS === "ios") {
            Purchases.configure({ apiKey: Constants.expoConfig.extra.revenueCatIosApiKey });
        } else if (Platform.OS === "android") {
            Purchases.configure({ apiKey: Constants.expoConfig.extra.revenueCatAndroidApiKey });
        }
    }, ]);

That's it. Nothing special, the paywall are working correctly, the app is already in production and I have 0 errors or warnings. But as I said, for 1 on 10 users, I will see in RevenueCat dashboard that they have an active subscription without our custom `userId` and without the `email`, `phoneNumber` and `username` specified. It literally means that we are losing subscriptions and subscribers.  

   1. Platform: iOS/Android
   2. SDK version: 8.6.1
   3. OS version: 18.1.3
   4. Xcode/Android Studio version: Expo SDK 52
   5. React Native version: 0.76.7
   6. SDK installation (CocoaPods + version or manual):  Expo SDK 52
   7. How widespread is the issue. Percentage of devices affected. 10%

 

Hi, could you please open a support ticket here and provide the following information:

  • Are you able to reproduce this on your end? If so please enable and provide RevenueCat debug logs here as there could be a warning, error, or just something in the flow that will help us identify what might be happening here
  • Can you share some of the users you have recently seen this with? I can check our server logs to see if there is anything strange happening there with them

Edit: I have found your support ticket and will follow up internally regarding this.


Hi, ​@yoni-touboul-ac82e9 I replied to your ticket on this. Please make sure to turn off "Track new purchases from server-to-server notifications" as this should solve what you are seeing with logIn's behavior. What happened with the user you provided is that the users did properly alias, but the feature assigned it to a new anonymous app user id which is why that was the one seen in the initial purchase event and then that user id was aliased with the other two.

In regards to the subscriber attributes, these will not sync if you are not doing anything in the app and just waiting. Syncing happens when the app is foregrounded, backgrounded, or when making a purchase. If you want you can also use the syncAttributesAndOfferingsIfNeeded() method to explicitly sync attributes mid-session, see our docs here. You can call this after you set the attributes.


Reply