Firebase cloud functions using Python?

19,141

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.

Share:
19,141

Related videos on Youtube

Gatmando
Author by

Gatmando

Updated on July 23, 2020

Comments

  • Gatmando
    Gatmando almost 4 years

    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

  • Gatmando
    Gatmando almost 5 years
    Thanks Doug - I'm glad to hear that we can continue deploying using Python. And thanks for confirming that the Firebase cli is an additive on top of GCP. We suspected as much but it's great to have it confirmed.
  • Eradicatore
    Eradicatore about 3 years
    Is there any way to use the flutter helper firebase wrappers with cloud functions deployed in python3? I tried returning json data, but now I get "firebase_functions/internal] Response is missing data field".
  • Eradicatore
    Eradicatore about 3 years
    so I just learned that if I add a "data" key to my response dictionary, it works. So the error message would have been clearer to me if it included quotes around the word 'data'. :-)