Angularfire: Load Firebase SDKs from reserved URLs

Created on 23 Mar 2020  路  6Comments  路  Source: angular/angularfire

I am fascinated to configure the api_keys from firebase hosting, see (https://firebase.google.com/docs/hosting/reserved-urls?authuser=3)

Version info

Angular: ~8.2.9

Firebase: ^7.8.0

AngularFire: 5.4.2

How to reproduce these conditions

Tring initialization with empty props

Expected behavior

AngularFireModule.initializeApp()

Actual behavior

AngularFireModule.initializeApp(environment.firebase)

Most helpful comment

Today my google-fu is better! yruzyui solved it on stackoverflow.
I think this ticket can be closed. Maybe a pointer in the getting started guide would be helpful.

All 6 comments

I am also struggling on how to get this to work with angularfire.

So far i have been unable to use the given example

fetch('/__/firebase/init.json').then(async response => {
  firebase.initializeApp(await response.json());
});

As i cannot get the async fetch to work well with the initialisation of my @NgModule imports or somehow initialize Firebase lazy.

Ohhh but also you can import JSON like another file in ES6.

interesting...

Well i did not manage to load the init.json from external before importing the module like shown in the setup guide. Any hints?

Today my google-fu is better! yruzyui solved it on stackoverflow.
I think this ticket can be closed. Maybe a pointer in the getting started guide would be helpful.

Thanks for reporting this, I'll keep this issue open as I'd rather not promote the practice at this time. I have a better solution in mind for an upcoming release.

We'll be using __init.json in a future release, closing this as we don't plan on loading the SDKs using this method.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sharomet picture sharomet  路  3Comments

jnupeter picture jnupeter  路  3Comments

Leanvitale picture Leanvitale  路  3Comments

martinyoussef picture martinyoussef  路  3Comments

fisherds picture fisherds  路  3Comments