Closed OutdatedGuy closed 2 days ago
Hello,
flutterfire configure
since a Demo project is local project that has not been created in the cloud yetdemo
is to run firebase emulators:start --project demo-test
locally using the Firebase emulator. You cannot create it in the Cloud.I think you have misunderstood the purpose of this argument which is to quickly test something using the emulator without having to run through all the setup in the Web interface.
Is there an existing issue for this?
Which plugins are affected?
Cloud Functions, Database, Storage
Which platforms are affected?
Android, iOS
Description
Using the new
demoProjectId
while initializing firebase app has a weird restriction.If you have already configured firebase using
flutterfire configure
then certain code is added in android and ios directories to usegoogle-services.json
&GoogleService-Info.plist
as firebase config.You cannot create a firebase project with a project id starting with
demo-
, hence you cannot useflutterfire configure
with a demo project (as it doesn't exist).Hence, when you use
demoProjectId
while initializing firebase, there aregoogle-services.json
&GoogleService-Info.plist
files with an actual project config instead of a demo ones. If you remove those files, you'll get errors like:So when using
demoProjectId
with actual project config ingoogle-services.json
&GoogleService-Info.plist
, services like Cloud Functions, Firestore, Realtime DB & Storage fails as they try to use the actual config.These are the issue with above mentioned services:
httpsCallable
will use the actual project id in the invoked url instead ofdemo-projectId
.actual-projectId.aappspot.com
instead ofdemo-projectId.aappspot.com
)Reproducing the issue
flutterfire configure -p {{projectId}} --platforms="android,ios";
firebase emulators:start --project demo-{{projectId}};
database.rules
,firestore.rules
&storage.rules
to allow all operationsFirebase.initializeApp(demoProjectId: 'demo-{{projectId}}');
{{projectId}}.appspot.com
instead ofdemo-{{projectId}}.appspot.com
bucket.Firebase Core version
3.1.0
Flutter Version
3.22.2
Relevant Log Output
No response
Flutter dependencies
Expand
Flutter dependencies
snippet```yaml Replace this line with the contents of your `flutter pub deps -- --style=compact`. ```
Additional context and comments
I then tried initializing firebase in flutter with
Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
and running local firebase emulator without--project demo-{{projectId}}
, and then everything works as expected.So the issue is most probably with the
demoProjectId
initialization in flutter.Also any updates in the
firestore.rules
andstorage.rules
files are not reflected when running with--project demo-{{projectId}}
.