Firebase cloud functions using Python?

PythonFirebaseGoogle Cloud-PlatformGoogle Cloud-FirestoreGoogle Cloud-Functions

Python Problem Overview


We are using GCP's Firebase with Firestore for a new mobile app we are developing. As part of this effort we need to deploy a number of cloud functions which will act as Firestore triggers for doing some back end processing.

Our intention is to keep the deploys encapsulated inside of Firebase by using the firebase cli tools. However when we attempt to initiate the Firebase project for functions using the "firebase init functions" call the only two language options are "Javascript" and "Typescript", and the only deployable stack seems to be Node.js.

On previous GCP projects we had deployed Python based cloud functions (using the gcloud cli) and ideally we'd like to continue using Python for our Firebase cloud functions. So my questions are:

  1. is it possible to deploy Python-based Firebase cloud functions? If not:

  2. can we simply go back to deploying Python-based GCP cloud functions using the gcloud cli and still have them work as Firestore triggers?

Thanks

Python Solutions


Solution 1 - Python

The Firebase CLI does not support deploying functions written in python.

You can certainly write Cloud Firestore triggers in python and deploy them with gcloud.

One thing you might not be aware of: the underlying Cloud Functions product is the same no matter how you deploy your functions. Firebase just adds tools and APIs on top of the existing Google Cloud Functions infrastructure. There is really no such thing as a "Firebase Cloud Function". There is just Cloud Functions, and you have options about how you can write and deploy them, either using gcloud, or the Firebase CLI.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionGatmandoView Question on Stackoverflow
Solution 1 - PythonDoug StevensonView Answer on Stackoverflow