-
Notifications
You must be signed in to change notification settings - Fork 100
[dashboard] Add crashlytics #3327
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
Conversation
| @@ -0,0 +1,76 @@ | |||
| // File generated by FlutterFire CLI. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we have some doc how this file is generated? Also any other generated files if any. maybe https://github.com/flutter/cocoon/tree/main/dashboard.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! Added to the README a setup for the repo, including the command to run.
| WidgetsFlutterBinding.ensureInitialized(); | ||
| await Firebase.initializeApp( | ||
| options: DefaultFirebaseOptions.currentPlatform, | ||
| ); | ||
| FlutterError.onError = (errorDetails) { | ||
| FirebaseCrashlytics.instance.recordFlutterFatalError(errorDetails); | ||
| }; | ||
| // Pass all uncaught asynchronous errors that aren't handled by the Flutter framework to Crashlytics | ||
| PlatformDispatcher.instance.onError = (error, stack) { | ||
| FirebaseCrashlytics.instance.recordError(error, stack, fatal: true); | ||
| return true; | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How much overhead time will this add to the existing flutter dashboard?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't notice any difference with or without. If anything, it adds a few ms on the first paint time.
dashboard/lib/firebase_options.dart
Outdated
| apiKey: 'AIzaSyCenA4U4l5CNiLJZDca2zlS0TrX8H7bV9s', | ||
| appId: '1:790958376406:web:abd3f6e0f2d7e77a439077', | ||
| messagingSenderId: '790958376406', | ||
| projectId: 'google.com:flutter-roll-on-borg', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From the pr description, seems it's not straightforward to enable firebase project in flutter-dashboard. But it is strange to send report of the flutter-dashboard app to a release project and will be a technical debt. What are some blockers or do you see any errors? Have you tried https://stackoverflow.com/questions/69174697/add-firebase-project-to-gcp-project?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One issue is the flutter-dashboard project is locked down, and so I'm not sure what's needed. Since this is only for debugging purposes on crashes, I think we should save the time.
If long term we want to move Cocoon to firebase, revisiting this SGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please hold a bit and I will give it a try. This seems an easy config change, and flutter-dashboard still makes more sense to me. Otherwise, we can go with the release project.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| } | ||
| WidgetsFlutterBinding.ensureInitialized(); | ||
| await Firebase.initializeApp( | ||
| options: DefaultFirebaseOptions.currentPlatform, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other platforms except web will not be touched due to https://github.com/flutter/cocoon/pull/3327/files#diff-99695bb7f8095cdaea1eb3980e281dba063929e1eebec879fcb76fcb30c1f6feR39-R41
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's only if you were to do flutter run lib/main.dart --help. Since exit comes from dart:io, we can't run it on the web platform.
| await Firebase.initializeApp( | ||
| options: DefaultFirebaseOptions.currentPlatform, | ||
| ); | ||
| FlutterError.onError = (errorDetails) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does Firebase.initializeApp do? Is it equivalent to the runApp below? I am wondering if this will be able to catch all crashes of the Flutter dashboard app.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
initializeApp setups a context so dependent firebase plugins can make calls to a given project. In it's current state, this should catch all crashes (both ones the framework catches and doesn't catch).
| <plist version="1.0"> | ||
| <dict> | ||
| <key>API_KEY</key> | ||
| <string>AIzaSyAOGTpCjagNvzVxgfsxMmISMN0Wgk2Wb7o</string> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this API key sensitive?
https://blog.gitguardian.com/leaking-secrets-on-github-what-to-do/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The recommended answer from Google Cloud is no. Since this is served in the frontend, it's not sensitive. Firebase verifies the app id or the website's hostname match what's been configured in Firebase before processing requests.
tvolkert
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
keyonghan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fixes flutter/flutter#52697
https://stackoverflow.com/questions/37482366/is-it-safe-to-expose-firebase-apikey-to-the-public verifies the firebase_options.dart is safe to be public.
Googlers can go to http://firebase/project/google.com:flutter-roll-on-borg/crashlytics/app/android:com.appspot.flutter_dashboard.dashboard/issues?state=open&time=last-seven-days&types=crash&tag=all&sort=eventCount to view crashes.
Using Flutter Roll on Borg as it's much easier to set up for than the existing flutter-dashboard project.
This will enable us to debug why the Android TVs are crashing after long periods of time.
Pre-launch Checklist
///).