Skip to content

Conversation

@CaseyHillers
Copy link
Contributor

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

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read the [Flutter Style Guide] recently, and have followed its advice.
  • I signed the [CLA].
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is [test-exempt].
  • All existing and new tests are passing.

@@ -0,0 +1,76 @@
// File generated by FlutterFire CLI.
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Comment on lines +49 to +60
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;
};
Copy link
Contributor

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?

Copy link
Contributor Author

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.

apiKey: 'AIzaSyCenA4U4l5CNiLJZDca2zlS0TrX8H7bV9s',
appId: '1:790958376406:web:abd3f6e0f2d7e77a439077',
messagingSenderId: '790958376406',
projectId: 'google.com:flutter-roll-on-borg',
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor

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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

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) {
Copy link
Contributor

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.

Copy link
Contributor Author

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>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

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.

Copy link
Contributor

@tvolkert tvolkert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Contributor

@keyonghan keyonghan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@CaseyHillers CaseyHillers added the autosubmit Merge PR when tree becomes green via auto submit App. label Dec 11, 2023
@auto-submit auto-submit bot merged commit cbacfe7 into flutter:main Dec 11, 2023
@CaseyHillers CaseyHillers deleted the crashlytics branch December 11, 2023 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Integrate a logging service with Cocoon's flutter app

3 participants