-
Notifications
You must be signed in to change notification settings - Fork 172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
There is no singleton instance #1090
Comments
👀 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out! |
Hi @mpastewski, |
Hi @mshmoustafa, Thanks for the note. Unfortunately, I wasn't able to identify it... Please check the full exception message below:
|
Thank you! Let me ask a mobile engineer for input on this. |
Hi @mpastewski, Yes, you are correct that you should not try to make any calls to Purchases until you have configured the SDK. A member of our engineering team took a look at the stack trace and did confirm that it is a result of attempting to display a paywall before calling configure. Are there any other places where you potentially use Paywalls prior to the configure? |
Hey @mpastewski, |
This issue still persists, We had checked the isConfigured status before executing any rc methods. Please fix !! |
I can confirm that the issue still persists, calling and awaiting on |
I am experiencing the same. I call |
Confirming exactly the same behaviour. |
I can confirm that I'm also experiencing the same issue. |
+1 |
Hi getting this issue almost daily logged on my crashlytics: |
Facing same issue |
I can also confirm this. |
There is still a problem. Please open it |
Thanks, everyone, for continuing to report this. We recently identified that this can happen on Android if:
This issue has been fixed in purchases-flutter 8.1.6. Can you please upgrade and let us know if this has been resolved? If you continue to experience this issue after upgrading, please share breadcrumb logs and the launchMode as these will help our team dig further into this. Thanks. |
Hello everyone, just in case anyone looking for a solution for the above issue, I faced the same issue and I fixed it by:
import 'dart:io' show Platform; import '../app_constants.dart'; export 'package:purchases_flutter/purchases_flutter.dart' Offerings? _offerings; PurchasesConfiguration? _configuration; PurchasesConfiguration? get configuration => _configuration; set customerInfo(CustomerInfo? customerInfo) => _customerInfo = customerInfo; Future initialize( Purchases.setLogLevel(LogLevel.info); try {
} on Exception catch (e) { // Purchase a package. List get activeEntitlementIds => _customerInfo != null Future loadOfferings() async { Future loadCustomerInfo() async { // Return if the user has the entitlement. // https://docs.revenuecat.com/docs/user-ids Future restorePurchases() async { await revenue_cat.initialize( |
I am using |
Same, we are getting a bunch of crashes that forced us to pause the rollout of our app. The very first thing we do is to configure RevenueCat, and the paywall is only invoke much later in the in the app. We never saw it happen in our tests which are mostly from cold starts. I could try and investigate it further, but ultimately, we will just ditch RevenueCat's paywall since the team here seems unable to fix this issue. Even if the crash doesn't affect users visibly, the reports feeding into the Play Store would tank our organic reach. |
Migrating away seems to be our only option as well because this issue has existed for a long time and still hasn’t been fixed. |
@jakobhec all the stack traces involve the Paywall component, so in my view, removing purchases_ui_flutter is enough. If you remove purchases_flutter, then you can't use RevenueCat at all! |
@diegofrata yes that would've been annoying! Let's hope you're right |
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.
There are a lot of things that can contribute to things not working. Having a very basic understanding of your environment will help us understand your issue faster!
Environment
flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.19.6, on macOS 14.5 23F79 darwin-arm64, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2022.3)
[✓] VS Code (version 1.89.1)
[✓] Connected device (3 available)
[✓] Network resources
• No issues found!
purchases-flutter
purchases_flutter: ^6.29.0
Android 12-14. Might also affect older Android versions
Affecting 3% of users in production according to Crashlytics
Fatal Exception: bi.g0: 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
I am not able to reproduce it at this stage
Other information (e.g. stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, etc.)
Describe the bug
According to Crashlytics, 3% are affected by this issue, causing fatal crash. I encapsulated RevenueCat functionality under the class below and only using this two functions to display paywall built on RevenueCat.
Additional context
On main screen init, I am calling (inside initState):
I always use PaywallLogic class to call RevenueCat. I tried to replace
await Purchases.isConfigured == false
with a custom boolean flag to track if RevenueCat has been already initiated or not, but it didn't help - I was thinking that I shouldn't use Purchases at all before configuration, however it also did not help.The text was updated successfully, but these errors were encountered: