[FIXED] Calling Firebase Functions v2 from Angular using Angular Fire
I am having small issue, after I migrated my Firebase Cloud Function (onCall) to v2 they suggest that it should be called via URL using
httpsCallableFromURL from ‘firebase/functions’. However, in our Angular project, we use https://github.com/angular/angularfire for calling the Cloud Functions. In
AngularFireFunctions there is only method
httpsCallable(name: string, options?: HttpsCallableOptions) which does not allow for calling function using URL.
Any idea how to call v2 function from AngularFire by url?
In order to use the
httpsCallableFromURL and still use
@angular/fire, you could use their new modular SDK (which got introduced with version 7).
Note, that this new SDK requires a slightly different setup of the app module, different injectable classes and functions, which have to be imported directly. See details in the sample of the AngularFire repo.
With this setup, you can import the
httpsCallableFromURL function to your service, component and use it (this basically uses the firebase SDK under the hood directly – see here).
Answered By – Pascal
Answer Checked By – David Marino (FixeMe Volunteer)