Paweł Kaczorowski
Paweł Kaczorowski

Reputation: 1562

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?

Upvotes: 4

Views: 1043

Answers (1)

Pascal
Pascal

Reputation: 418

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).

Upvotes: 2

Related Questions