flutterfire
flutterfire copied to clipboard
🐛 [firebase_performance] Usage Regression
Bug report
The recent change by @yalunqin to introduce web support (see https://github.com/FirebaseExtended/flutterfire/pull/6920) introduced a (for us severe actually) regression that does not allow you to use Firebase performance on startup anymore.
What we did before the recent changes were to start a trace as soon as the main function of our app is called. The same code now produces:
Stack trace:
#0 MethodChannelFirebase.app
package:firebase_core_platform_interface/…/method_channel/method_channel_firebase.dart:122
#1 Firebase.app
package:firebase_core/src/firebase.dart:55
#2 new FirebasePerformance._
package:firebase_performance/src/firebase_performance.dart:13
#3 FirebasePerformance.instance
package:firebase_performance/src/firebase_performance.dart:18
#4 FirebasePerformance.instance (package:firebase_performance/src/firebase_performance.dart)
package:firebase_performance/src/firebase_performance.dart:1
I had manually implemented web support and both web and mobile did work perfectly when using them as the first actions in main.
Sample code
void main() {
WidgetsFlutterBInding.ensureInitialized();
// Start performance trace here.
runApp(..);
}
Having to call await Firebase.initializeApp breaks this because it would delay the tracking by ~0.2 seconds at least and way more in some cases.
Expected behavior
It should be possible to use Firebase Performance without having to wait for Firebase.initializeApp, like it was possible prior to https://github.com/FirebaseExtended/flutterfire/pull/6851.
Workaround
We are downgrading back to firebase_performance: 0.7.0 with our custom web implementation that works immediately when the app is started.
@creativecreatorormaybenot Thanks for reporting this issue. I'll take a look and hopefully send out a fix today.
Hi @creativecreatorormaybenot ,
Thank you for your report! Since this issue was opened, the implementation details have changed significantly. If you feel that this issue is still relevant, please feel free to open a new issue with updated context. We appreciate your understanding and support.
Hey there, I am closing this issue as this ticket is stale but please feel free to reopen this if the issue persists.