Firebase cloud functions using Python?

Question:

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

Asked By: Gatmando

||

Answers:

EDIT May 5, 2023:

Firebase now supports functions written in python in an early public preview. See: https://firebase.google.com/docs/functions/get-started?gen=2nd#python-preview


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.

Answered By: Doug Stevenson