title: Cloud Function No Logging
body: <p>I'm trying to create a FCM when there is a change in my Firebase Realtime Database. The Cloud Function code is pasted below. So far no notifications are showing so I'm trying to see if the cloud function is correct. However, I'm not seeing the logs either on the Firebase console so debugging has been difficult. Can anyone provide insights why the logs are not showing? The deployment completed without issues.</p>
  <pre class="lang-js prettyprint-override"><code>const functions = require(&quot;firebase-functions&quot;);
  const admin = require('firebase-admin');
  
  admin.initializeApp(functions.config.firebase);
  
  
  exports.notificationFCM = functions.database.ref('/chats/{userId}').onCreate(async (snapshot, context) =&gt; { 
    const userId = context.params.userId;
        const payload = {
          notifiction: {
            title: `New message`,
            body: `Click to check your message!`,
            badge: `1`,
            sound: `default`
          }
          };
       
       const token = await admin.database()
      .ref(`tokens/${userId}`)
      .once('value');
    if (token.val().deviceToken != null) {
      console.log(userId);
      console.log('Sucess');
      return admin.messaging().sendToDevice(token.val().deviceToken, payload);
  
    }
    else {
      console.log('No token avaliable');
      console.log(userId);
    }
  });
  </code></pre>
  <p><strong>package.json</strong></p>
  <pre class="lang-json prettyprint-override"><code>{
    &quot;name&quot;: &quot;functions&quot;,
    &quot;description&quot;: &quot;Cloud Functions for Firebase&quot;,
    &quot;scripts&quot;: {
      &quot;serve&quot;: &quot;firebase emulators:start --only functions&quot;,
      &quot;shell&quot;: &quot;firebase functions:shell&quot;,
      &quot;start&quot;: &quot;npm run shell&quot;,
      &quot;deploy&quot;: &quot;firebase deploy --only functions&quot;,
      &quot;logs&quot;: &quot;firebase functions:log&quot;
    },
    &quot;engines&quot;: {
      &quot;node&quot;: &quot;14&quot;
    },
    &quot;main&quot;: &quot;index.js&quot;,
    &quot;dependencies&quot;: {
      &quot;firebase-admin&quot;: &quot;^9.8.0&quot;,
      &quot;firebase-functions&quot;: &quot;^3.14.1&quot;
    },
    &quot;devDependencies&quot;: {
      &quot;firebase-functions-test&quot;: &quot;^0.2.0&quot;
    },
    &quot;private&quot;: true
  }
  </code></pre>