RevenueCat / RevenueCat/purchases-flutter

Android is all of a sudden DEAD - getCustomerInfo doesn't work and getOfferings

Open
#992 23 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Dart
Stars
720
Forks
209
Avg merge
11h 29m
Merged PRs (30d)
30

Description

Environment

  • Output of flutter doctor
[√] Flutter (Channel stable, 3.19.1, on Microsoft Windows [Version 10.0.22621.3155], locale en-GB)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.6.1)
[√] Android Studio (version 2022.3)
[√] VS Code (version 1.86.2)
[√] Connected device (4 available)
[√] Network resources
  • Version of purchases-flutter

6.21.1

  • Testing device version e.g.: iOS 15.5, Android API 30, etc.
Pixelel 4 / 7
API 33 / 34
  • How often the issue occurs- every one of your customers is impacted? Only in dev?

Live and dev

D/[Purchases] - DEBUG(19380): ℹ️ Debug logging enabled
D/[Purchases] - DEBUG(19380): ℹ️ SDK Version - 7.5.2
D/[Purchases] - DEBUG(19380): ℹ️ Package name - com.thrudayapp.thruday_app
D/[Purchases] - DEBUG(19380): 👤 Initial App User ID - 44650fcf-fc04-4274-9025-86da81be8e8f
D/[Purchases] - DEBUG(19380): ℹ️ Purchases configured with response verification: DISABLED
D/[Purchases] - DEBUG(19380): 👤 Identifying App User ID: 44650fcf-fc04-4274-9025-86da81be8e8f
D/[Purchases] - DEBUG(19380): ℹ️ Deleting old synced subscriber attributes that don't belong to 44650fcf-fc04-4274-9025-86da81be88e8f
D/[Purchases] - DEBUG(19380): ℹ️ App foregrounded
D/[Purchases] - DEBUG(19380): ℹ️ CustomerInfo cache is stale, updating from network in foreground.
D/[Purchases] - DEBUG(19380): Retrieving customer info with policy: FETCH_CURRENT
D/[Purchases] - DEBUG(19380): ℹ️ Updating pending purchase queue
D/[Purchases] - DEBUG(19380): ℹ️ Offerings cache is stale, updating from network in foreground
D/[Purchases] - DEBUG(19380): 😻 Start Offerings update from network.
D/[Purchases] - DEBUG(19380): ℹ️ Querying purchases
D/[Purchases] - DEBUG(19380): Request already scheduled with jitter delay, adding existing callbacks to unjittered request with key: BackgroundAwareCallbackCacheKey(cacheKey=[/subscribers/44650fcf-fc04-4274-9025-86da81be8e8f/offerings], appInBackground=false)
D/[Purchases] - DEBUG(19380): ℹ️ Updating pending purchase queue
D/[Purchases] - DEBUG(19380): ℹ️ Querying purchases
D/[Purchases] - DEBUG(19380): ℹ️ Found 3 unsynced attributes for App User ID: 44650fcf-fc04-4274-9025-86da81be8e8fSubscriberAttriibute(key=SubscriberAttributeKey('$email'), value=andy@pixelbin.com, setTime=Mon Feb 26 22:30:30 GMT 2024, isSynced=false)        
D/[Purchases] - DEBUG(19380): SubscriberAttribute(key=SubscriberAttributeKey('$displayName'), value=Andy Cresswell, setTime=Mon Feb 26 22:30:30 GMT 2024, isSynced=false)
D/[Purchases] - DEBUG(19380): SubscriberAttribute(key=SubscriberAttributeKey('$firebaseAppInstanceId'), value=2ad6b90895a966152a22675dcad73154, setTime=Mon Feb 26 22:30:30 GMT 2024, isSynced=false)
D/[Purchases] - DEBUG(19380): Product entitlement mappings are stale. Updating.
D/[Purchases] - DEBUG(19380): ℹ️ Listener set
D/[Purchases] - DEBUG(19380): ℹ️ Starting connection for com.android.billingclient.api.BillingClientImpl@dfbe16a
D/[Purchases] - DEBUG(19380): ℹ️ setEmail called
D/[Purchases] - DEBUG(19380): ℹ️ setDisplayName called
D/[Purchases] - DEBUG(19380): ℹ️ Billing Service Setup finished for com.android.billingclient.api.BillingClientImpl@dfbe16a
D/[Purchases] - DEBUG(19380): ℹ️ Updating pending purchase queue
D/[Purchases] - DEBUG(19380): ℹ️ Querying purchases
D/[Purchases] - DEBUG(19380): ℹ️ Cleaning previously sent tokens
D/[Purchases] - DEBUG(19380): ℹ️ Tokens already posted: []
D/[Purchases] - DEBUG(19380): ℹ️ Saving tokens []
D/[Purchases] - DEBUG(19380): ℹ️ Tokens already posted: []
D/[Purchases] - DEBUG(19380): ℹ️ No pending purchases to sync
D/[Purchases] - DEBUG(19380): ℹ️ Cleaning previously sent tokens
D/[Purchases] - DEBUG(19380): ℹ️ Tokens already posted: []
D/[Purchases] - DEBUG(19380): ℹ️ Saving tokens []
D/[Purchases] - DEBUG(19380): ℹ️ Tokens already posted: []
D/[Purchases] - DEBUG(19380): ℹ️ No pending purchases to sync
D/[Purchases] - DEBUG(19380): ℹ️ Cleaning previously sent tokens
D/[Purchases] - DEBUG(19380): ℹ️ Tokens already posted: []
D/[Purchases] - DEBUG(19380): ℹ️ Saving tokens []
D/[Purchases] - DEBUG(19380): ℹ️ Tokens already posted: []
D/[Purchases] - DEBUG(19380): ℹ️ No pending purchases to sync
D/[Purchases] - DEBUG(19380): Request already scheduled with jitter delay, adding existing callbacks to unjittered request with key: BackgroundAwareCallbackCacheKey(cacheKey=[/subscribers/44650fcf-fc04-4274-9025-86da81be8e8f], appInBackground=false)
D/[Purchases] - DEBUG(19380): ℹ️ setFirebaseAppInstanceID called
D/EGL_emulation(19380): app_time_stats: avg=90.27ms min=12.04ms max=555.66ms count=17
D/[Purchases] - DEBUG(19380): Billing connected with country code: GB
  • 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.)

Describe the bug

25/02/2024 - Android stops completing futures...

  1. getCustomersInfo never completes
  2. getOfferings never compeletes
  3. Live and Sandbox
  4. No changes to cause this

When loading the subscriptions page and I try to load offerings;

/flutter (19380): ---------------------------------------------
I/flutter (19380): [is configured, true]
I/flutter (19380): ---------------------------------------------
I/flutter (19380): Settings up offerings
D/[Purchases] - DEBUG(19380): ℹ️ No cached Offerings, fetching from network
D/[Purchases] - DEBUG(19380): 😻 Start Offerings update from network.
D/[Purchases] - DEBUG(19380): Same call already in progress, adding to callbacks map with key: BackgroundAwareCallbackCacheKey(cacheKey=[/subscribers/44650fcf-fc04-4274-9025-86da81be8e8f/offerings], appInBackground=false)
D/[Purchases] - DEBUG(19380): Request already scheduled with jitter delay, adding existing callbacks to unjittered request with key: BackgroundAwareCallbackCacheKey(cacheKey=[/subscribers/44650fcf-fc04-4274-9025-86da81be8e8f/offerings], appInBackground=false)

And the code that produces the above debug log

@override
  void initState(){
    super.initState();

    Purchases.isConfigured.then((isConfigured) async {

      print('---------------------------------------------');
      print(['is configured', isConfigured]);
      
      // this never returns or completes!!
      print(['customerInfo', await Purchases.getCustomerInfo()]);
      
      if(await Purchases.appUserID != AuthedUser.get!.id){
        // login the user
        await Purchases.logIn(AuthedUser.get!.id);
        // ensure we have the latest customer info
        Provider.of<AppPurchaser>(context, listen: false)
          .updateCustomerInfo();
      }

      // ensure we can make payments
      if(await Purchases.canMakePayments()){
        // get our offerings for selected
        setupOfferings();
      } else {
        print('cant make purchases');
      }
    });

  }

  void setupOfferings() async {
    try {

      print('---------------------------------------------');
      print('Settings up offerings');
      
      // this does not return or complete!!
      offerings = await Purchases.getOfferings();
      

      if (offerings!.current != null) {
        
        if(null != offerings!.current!.monthly && null != offerings!.current!.annual){
          setState(() {
            subscriptions = [
              offerings!.current!.monthly!,
              offerings!.current!.annual!
            ];
          });
        }

      } else {
        FirebaseCrashlytics.instance.log('No offerings loaded, offerings: $offerings');
        
        setState(() {
          _error = 'There seem to be no offerings available at the moment. Please try again later.' as PlatformException;
        });
      }

    } on PlatformException catch (e) {
        FirebaseCrashlytics.instance.log(e.toString());
        setState(() {
          _error = e;
        });
    }
  }

I've checked the profiler, I see no network requests being made at all...
Network requests to my own custom API backend works
If I manually query the subscriber endpoint using POSTMAN, offerings return
Problem is only on Android, offerings / system works fine on Apple
No changes with in Play Developer to cause this

Literally, started for no reason

Additional context

I got to a point where I started going through commits and got it down to where I updated the versions of;

flutter_keyboard_visability: 6.0.0
wolt_modal_sheet: 0.4.1
flutter_quill: 9.2.12

I have epilepsy, I am struggling after this - I will further figure out tomorrow which of this plugins caused this.

I have analysed the rest of the commit and there is nothing that could stop network requests getting through.

Day 3: I have now added back in the above plugins, cleaned the installation and tried again - still working so, there is two possibilities here;

  1. The problem was with RevenueCat and they silently fixed it
  2. Something corrupted the installation when trying to apply the above plugins

I have obsessively checked all commits, nothing there could have caused this - I am lost for words and can't even offer any help to someone facing the same problem.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The report names no repository files or tests; start by reproducing on Android with Flutter 3.19.1 and purchases-flutter 6.21.1, using the logged calls to Purchases.getCustomerInfo() and Purchases.getOfferings(). Trace the Android request path around the stalled futures and compare it with the working Apple path. Done means identifying a reproducible cause and confirming that both calls complete or return an actionable error.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, dart, flutter
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.