firebase function


Cloud Functions for Firebase is a serverless framework that lets you automatically run backend code in response to events triggered by Firebase features and HTTPS requests.

https://firebase.google.com/docs/functions


Backlinks

firebase_notes_to_supabaseA firebase function that is triggered whenever a note is created or modified. This function then updates the note within supabase. 1. With the updated note data from the firebase trigger, a query is made to firebase for the same note within supabase 1. If the note from firebase was modified_at later than the note from supabase or if it is not a new note, then we skip the following steps. 1. Otherwise, upsert the updated note into firebase from supabase. exports.firebase_notes_to_supabase = funget_stripe_id_from_firebase_uidA firebase function that gets the stripe customer id given a firebase user id. 1. Makes a query to a table given a firebase_user_id 1. Returns the stripe_customer_id found the document within the table exports.get_stripe_id_from_firebase_uid = functions.https.onRequest(async (req, res) => { // Step 1 const uid = req.body.uid; const ref = db.collection(customers).doc(uid); const doc = await ref.get(); // Step 2 const stripeId = doc.data()?.stripeId; return res.status(200).json({ supabase_notes_to_firebaseA firebase function that is called from firebase with the updated note data through a database webhook. This function updates the note within firebase from supabase. 1. With the updated note data from the supabase, a query is made to supabase for the same note within firebase 1. If the note from supabase was modified_at later than the note from firebase, then we skip the following steps. 1. Otherwise, upsert the updated note into supabase from firebase. exports.supabase_notes_to_firebase = funtransfer_encryption_keyA firebase function that transfers the hashed encryption key for end-to-end encryption from firebase to supabase. 1. The function takes supabase_user_id as an input 1. The supabase_user is queried based on the supabase uid 1. The firebase_user_id is extracted from the supabase_user 1. encryption_key is queried from firebase using the firebase_user_id 1. The supabase_user_id and the encryption_key are upserted into supabase exports.transfer_encryption_key = functions.https.onRequest(async (req,update_stripe_customer_idA firebase function that is triggered whenever a new stripe customer is added from the firebase stripe extension. The function then updates the supabase table with the correct stripe_customer_id. Steps: 1. Firebase function is triggered 1. The supabase_user_id is queried using the firebase_user_id 1. If a supabase_user_id exists, then upserts the supabase_user_id along with the stripe_customer_id into a table. exports.update_stripe_customer_id = functions.firestore.document('customers/{uid}')