title: Error In function After Firebase Deploying
body: <p><strong>Database Structure</strong></p>
  
  <p><a href="https://i.stack.imgur.com/ljqoz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ljqoz.png" alt="enter image description here"></a></p>
  
  <p><strong>Notification Structure</strong></p>
  
  <p><a href="https://i.stack.imgur.com/jgwS8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jgwS8.png" alt="enter image description here"></a></p>
  
  <p>After successfully deploying my function into fire-base I am having these error in firebase function logs</p>
  
  <pre><code>  1: Function execution took 1724 ms, finished with status: 'error'
    2:TypeError: Cannot read property 'uid' of undefined
     at exports.sendNotification.functions.firestore.document.onWrite.event 
     (/user_code/index.js:9:30)
     at cloudFunctionNewSignature (/user_code/node_modules/firebase- 
     functions/lib/cloud-functions.js:105:23)
     at cloudFunction (/user_code/node_modules/firebase-functions/lib/cloud- 
     functions.js:135:20)
     at /var/tmp/worker/worker.js:733:24
     at process._tickDomainCallback (internal/process/next_tick.js:135:7)
    3:{"@type":"type.googleapis.com/google.cloud.audit.AuditLog","status": 
      {"code":3,"message":"The request has errors"},"authenticationInfo": 
      {"principalEmail":"info.jap.123@gmail.com"},"requestMetadata"{"callerIp":"39.50.37.100",
  </code></pre>
  
  <p>Index.js </p>
  
  <pre><code>'use-strict'
  
   const functions = require('firebase-functions');
   const admin = require('firebase-admin');
   //admin.initializeApp(functions.config().firebase);
   exports.sendNotification = 
   functions.firestore. 
   document("Users/{uid}/Notification/{nid}").onWrite(event=&gt; 
    {
     const user_id = event.params.uid
     const notification_id = event.params.nid;
  
   });
  </code></pre>
  
  <p>Notification Class in this class i am storing the notification id and message into Firebase-Firestore.</p>
  
  <pre><code>  private void sendNotification()
  {
      String number = edTxtDevId.getText().toString();
      if (TextUtils.isEmpty(number))
      {
          edTxtDevId.setError("Please Provide the dev id thank you");
          return;
      }
      Calendar cal = Calendar.getInstance();
      SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss.SSS");
      String time = String.valueOf(cal.getTime());
      final String message = "Notification has been sent to this number "+number+" by this number "+user_id+" at time = "+time;
      Map&lt;String , Object&gt; notificationMessage = new HashMap&lt;&gt;();
      notificationMessage.put("From" , mUserId);
      notificationMessage.put("message" , message);
      for (int i = 0 ; i &lt; userList.size() ; i++)
      {
  
          if (userList.get(i).equals(number))
          {
              Log.e(TAG, "sendNotification: "+number+" found " +userList.get(i) + " id = "+i);
              Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
              mFirestore.collection("Users/"+mUserId+"/Notification").add(notificationMessage).addOnSuccessListener(new OnSuccessListener&lt;DocumentReference&gt;() {
                  @Override
                  public void onSuccess(DocumentReference documentReference) {
                      Toast.makeText(MainActivity.this, message, Toast.LENGTH_SHORT).show();
                  }
              });
          }
      }
  }
  </code></pre>
  
  <p>Please help me if you know how to solve these
  Thank you in advance!</p>