Skip to content
Star
478
Star
478

Storage Writer

This guide shows you how to work with Google Cloud Functions locally using the Firebase Emulator Suite and Python. This lab demonstrates how to create an HTTP-triggered function that uploads files to Cloud Storage.

  1. Setup Environment:

    Open VS Code in the project folder and execute this command in the Command Palette:

    Terminal window
    > Dev Containers: Reopen in Container
  2. Set up the functions virtual environment:

    Terminal window
    python3.12 -m venv functions/venv && functions/venv/bin/pip install -r functions/requirements.txt
  3. Start Firebase Emulators:

    Terminal window
    firebase emulators:start
  4. Run the Example:

    Terminal window
    python test_function.py

Open the Firebase Emulator UI and navigate to the Storage tab to verify the uploaded file:

Terminal window
http://localhost:4000/storage

Stop the emulators by pressing Ctrl+C in the terminal running firebase emulators:start. To clear emulator data:

Terminal window
rm -rf .firebase