Repository navigation
fix(core): use valid-format placeholder options for demoProjectId apps - #18792
Conversation
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. |
Description
Firebase.initializeApp(demoProjectId: ...)fills in placeholder options with API key'12345'and an emptymessagingSenderId. On Apple platforms, native Firebase SDKs check these values as soon as the app is configured, and they raise uncaught exceptions that abort the app:firebase_crashlytics,firebase_messagingand others pull in, requires an API key of 39 URL-safe base64 characters starting withA.This PR changes the placeholder API key to
'ADemoProjectApiKey000000000000000000000'and the sender ID to'1', which matches the project number in the placeholder app ID1:1:<platform>:1. The key deliberately doesn't start withAIza, so secret scanners won't flag it as a leaked Google API key. Android's Firebase Installations uses the same key format, so both values apply on every platform. Emulators accept any API key.Related Issues
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]).This will ensure a smooth and quick review process. Updating the
pubspec.yamland changelogs is not required.///).melos run analyze) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?
Test plan
Firebase.initializeApp() with demoProjectIdintests/integration_test/firebase_core/firebase_core_e2e_test.dart, which runs in the core shard. On an iOS simulator with thetestsapp, the app aborts during this test onmainand passes with this change.flutter test test/firebase_core_test.dartinpackages/firebase_core/firebase_corepasses with the updated expected options.