Mihail_OLARU
Mihail_OLARU

Reputation: 13

Use the same Firebase cloud function in different projects

Created a React + Firebase web app. Another developer made a IOS app and the apps need to share the same database. Also, he defined some cloud functions that I also have use. When calling the functions in my project: functions.httpsCallable('deleteArticle'); ... I am getting a CORS error. That is the first time I am using Firebae and I can not understand is it possible to call the already defined functions from FireBase or I have to define them again in my project?

Upvotes: 0

Views: 911

Answers (1)

Renaud Tarnec
Renaud Tarnec

Reputation: 83093

The apps need to share the same database

In this case, the standard/classical approach is to register the iOS and web apps with the same Firebase project. See "Adding apps to a project" in the doc for more details.

In this case, your Callable Cloud Functions are shared by the two apps (as well as the database) and the Cloud Functions can be seamlessly called from the two apps, since they point to the same Firebase project.


If you really need to have different Firebase projects, you can use two (or more) Firebase projects in your app. But in your case, you’ll need a distinct Firebase application object to reference each Firebase project individually. See "Configure multiple projects" and in particular the "Use multiple projects in your application" section.


Based on the info you shared in your question, it seems that you should go with option one.

Upvotes: 2

Related Questions