Skip to main content

Google Ad Mob

This Brick ...

Dependencies

Setup

To install cloud functions in python we will use a virtual environment. At the moment of writing this document, cloud functions require to use python 3.12.

Python 3.12 Installation

Start by checking which version of Python you have installed. Run the following command:

python3 --version

If you don't have Python 3.12 installed, you can download it via brew :

brew install python@3.12

Then you'll have to add it to your path. Copy the installation path and add it to you zshrc or bashrc file.

brew --prefix python@3.12
vim ~/.zshrc

Add the following line :

export PATH="/path/to/python@3.12:$PATH"  

Initialize Cloud Fuctions

Use the Firebase CLI to initialize Cloud Functions in your project. Run the following command:

firebase init functions

You'll have to chose between typescript, javascript and python. Choose python. For the name of the

Create a Virtual Environment

To create a virtual environment, run the following command:

python3 -m venv venv

Input Parameters

Doctor

Cloud Functions

How Does It Work?


2.3. Setup Cloud Functions

Cloud Functions are a way to run backend code in response to events triggered by Firebase services or HTTPS requests. Setting up Cloud Functions at the beginning of your project can offer advantages in terms of seamless integration. However, it's not mandatory and largely depends on the specific requirements of your application.

Configuring Cloud Functions:

  1. If you choose to use Cloud Functions, you can utilize Codika's Cloud Function Architecture. Initiate it with the following command:

    mason make flutter_cloud_functions
  2. Use dotenv for handling environment variables within your cloud functions. Navigate to the functions folder and include it in the dependencies:

    cd functions
    npm install --save dotenv
  3. Before deploying the functions, ensure that your project is on the Firebase Blaze payment plan. The flutter_cloud_functions architecture comes with a quick test function that gets triggered upon a document's creation. To deploy it, run:

    cd functions
    npm run-script lint -- --fix
    firebase deploy --only functions
    • If you encounter an error indicating a failure to get the Firebase project, this might be due to your Firebase account being de-logged. Re-authenticate with:

      firebase logout
      firebase login