Realtime Database triggers (pt. 1) with Cloud Functions for Firebase – Firecasts

Realtime Database triggers (pt. 1) with Cloud Functions for Firebase – Firecasts


Danny Hutson

31 thoughts on “Realtime Database triggers (pt. 1) with Cloud Functions for Firebase – Firecasts

  1. Wow! You know what I really admire about you… You're actually taking time to explain things. Its no more feeling like a,"hey check this out" video… Its actually something that coders like me look forward too. Thanks again. And congratulations on the great work. 🙂

  2. Thanks Doug for uploading this…very much needed for today's work itself..!! Please post next parts also..!!

  3. These videos are really helpful!!
    I did however try to use snapshot.val() and got a "snapshot.val is not a function" error.
    Got it working using snapshot.after.val()
    If i'm correct there is also snapshot.before.val() for getting the value before the write that triggered the function.

    Keep these videos coming!

  4. Hi I have a question can you help me please?

    I want to use firebase database in an android project. I have to make database private so that nobody can change data without using my application. So clearly I want to give editing permission for database to only user of my application. But I don't want to use "sign in" method (google, facebook etc).

    Is that possible?

  5. Please do a video on how to run Chron Jobs in TypeScript. There isn't a video that teaches us. Actually, there is but is marked as DEPRECREATED by Jen Person. Please do a new Video

  6. One reason to do this on the client side is to save costs firebase will charge for invocations and writes which in turn is very costly.
    On a side note, it would be great if google choose not to completely ignore react-native.

  7. These tutorials are really awesome !! Can we wrap google drive API and cloud functions to add certain functionalities?

  8. Where to write this code?
    I am making a chat application Using Firestore, I need to send push notifications on the receiver ene when someone send message.
    Please can anyone help me.

  9. I also have to deal with firestore, for anyone curious how things would look in that case, here's an onUpdate function:

    exports.updateReport = functions.firestore
    .document("reports/{reportId}")
    .onUpdate((change, context) => {
    return change.after.ref.set(
    {
    is_filled: true
    },
    { merge: true }
    );
    });

  10. First thanks for the awesome video. Second, I tried applying this to Firestore but the ref.update() does not work. It shows an error "Cannot read property 'update' of undefined
    at exports.onItemUpdate.functions.firestore.document.onUpdate (/user_code/lib/index.js:58:29)". Can you help me?

    Here's the code
    export const onItemUpdate = functions

    .firestore

    .document('Items/{itemID}').onUpdate((change, context) =>{

    const itemBefore = change.before.data();

    const itemAfter = change.after.data();

    if (itemAfter['item_doc'] === itemBefore['item_doc']){

    console.log("Item has no new data");

    return null;

    }else {

    const itemName = itemAfter['item_name'];

    const itemDescription: string = itemAfter['item_description'];

    const itemPriceDescription: string = itemAfter['item_price_description'];

    const itemDoc: string = itemName.concat(" ", itemDescription, " ", itemPriceDescription);

    console.log("Item has updated data");

    return itemAfter.ref.update({item_doc: itemDoc})

    }

    });

  11. sir please answer me
    how to call an api in cloud function?
    i am trying this code

    const theUrl = "myapi";

    var xmlHttp = new XMLHttpRequest();

    xmlHttp.open( "GET", theUrl, false ); // false for synchronous request

    xmlHttp.send( null );

    return null

    but note working!
    please help me
    show an error
    ReferenceError: XMLHttpRequest is not defined

    at exports.checkData.functions.database.ref.onUpdate (/user_code/index.js:24:31)

    at cloudFunctionNewSignature (/user_code/node_modules/firebase-functions/lib/cloud-functions.js:120:23)

    at cloudFunction (/user_code/node_modules/firebase-functions/lib/cloud-functions.js:151:20)

    at /var/tmp/worker/worker.js:827:24

    at process._tickDomainCallback (internal/process/next_tick.js:135:7)

  12. Cool. Awesome tutorial video. Those wild cards were making me a bit confused. But thanks for clarifying them!

  13. I'd really like to use Cloud Functions but its very confucsing that you're constantly switching between Javascript ans Typescript. In these videos you use Typescript and in the documentation (https://firebase.google.com/docs/functions/database-events) everything is in javascript. Can you somehow at least make the documentation for both variants?

Leave a Reply

Your email address will not be published. Required fields are marked *