I am trying to use python with firebase functions. I already have a function running for my webhooks. but I tried to add another function to run when a new record is created on RealtimeDatabase, without success.
I tried using the CLI at first, following the steps and using this code from the quickstart :
from typing import Any
# The Cloud Functions for Firebase SDK to create Cloud Functions and set up triggers.
from firebase_functions import db_fn
# The Firebase Admin SDK to access the Firebase Realtime Database.
from firebase_admin import initialize_app, db
app = initialize_app()
@db_fn.on_value_written(reference="/Stores/{storeID}")
def onwrittenfunctiondefault(event: db_fn.Event[db_fn.Change]) -> None:
print(event.data)
You can see I switched to on_value_written to catch any change on the path Stores/{storeID} I don't know what am i missing..
I also tried to create the function from google cloud console, created the eventarc trigger and it was deployed successfully. but when I add anything to the database, it is not triggered.
Does anyone have an idea what I need to do?
source https://stackoverflow.com/questions/76331998/firebase-function-v2-trigger-for-realtimedatabase-using-a-python-script-is-not-w
Comments
Post a Comment