title: Why this Firebase database trigger not working
body: <p>I'm planning to write a Firebase database trigger. My use case is very simple. Whenever Facebook messenger webhook called database gets updated with user text message and using the Firebase database trigger to get the message from AI and return back to messenger.</p>
  
  <p>Right now my Firebase database trigger is not working. Even though my test cases are all passed. </p>
  
  <pre><code>myapp
  |_ messages
     |__ 432423423423
       |__ 32432432432423
          |__ owrijrw8hy2487hf34
            |_ recipient: "45354353"
            |_ sender: "422342342"
            |_ text: "this is text"
  </code></pre>
  
  <p>Now I want to perform sending message back to user using firebase database trigger. </p>
  
  <pre><code>// Realtime Database triggers
  exports.facebookMessage = functions.database.ref('/messages/{pageID}/{userID}')
    .onCreate(event =&gt; {
      console.log(event)
      return;
    })
  </code></pre>
  
  <p>/test.js</p>
  
  <pre><code>describe('Database /messages/{pageID}/{userID}', () =&gt; {
      it('Should trigger when the message write it t', () =&gt; {
  
        pushParam = {
          text:  'Hello',
          sender: 'USER_ID',
          recipient: 'PAGE_ID',
          timestamp: 1458692752478
        }
  
        // Firebase database fake event
        const fakeEvent = {
          // DeltaSnapshot(app: firebase.app.App, adminApp: firebase.app.App, data: any, delta: any, path?: string);
          data: new functions.database.DeltaSnapshot(null, null, null, pushParam),
          params: {
            pageID: 'PAGE_ID',
            userID: 'USER_ID'
          }
        }
  
        // Stub data reference
        refParam = '/messages/'
        childPageParam = 'PAGE_ID'
        childUserParam = 'USER_ID'
  
        // Stubs are objects that fake and/or record function calls.
        // These are excellent for verifying that functions have been called and to validate the
        // parameters passed to those functions.
        const refStub = sinon.stub()
        const childPageStub = sinon.stub()
        const childUserStub = sinon.stub()
        const pushStub = sinon.stub()
  
        Object.defineProperty(fakeEvent.data, 'ref', {get: refStub})
        refStub.returns({parent: {child: childPageStub}})
        childPageStub.returns({parent: {child: childUserStub}})
        childUserStub.returns({push: pushStub})
        pushStub.withArgs(pushParam).returns(true)
  
        return assert.eventually.equal(fiobotFunctions.facebookMessage(fakeEvent), undefined);
  </code></pre>
  
  <p>In console I don't see any logs from facebookMessage what should I do now?</p>