title: firestore cloud functions not triggering
body: <p>I am new to firebase cloud functions. So, I followed the tutorial in firebase youtube channel.
  So, I created a function that should trigger when firestore document added,but it didn't trigger.</p>
  
  <p>this is the function</p>
  
  <pre><code>const functions = require("firebase-functions");
  const admin = require("firebase-admin");
  
  admin.initializeApp();
  
  exports.whenAddData = functions.firestore
    .document("chats/{userId}")
    .onCreate((change, context) =&gt; {
      const msg = change.data().msg;
      const modifiedMsg = addImoji(msg);
      console.log("data changing");
      return change.ref({ msg: modifiedMsg });
    });
  
  const addImoji = (msg) =&gt; {
    return msg.replace(/\bPizza\b/g, "  ");
  };
  
  </code></pre>
  
  <p>firebase-functions version: "^3.6.1"</p>
  
  <p>firestore db screenshot
  <a href="https://i.stack.imgur.com/axhU8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/axhU8.png" alt="enter image description here"></a></p>