Exception while invoking method error in terminal


This is the error i’m getting from terminal

this is the meteor method i wrote it in the server
getCustomerNameByAppIdReactive: function(appointmentId){

** let customerId = Appointments.findOne({_id:appointmentId}).customerId;**
** if(customerId == “1”){**
** return “Walk-In Customer”;**
** }else{**
** return Customers.findOne({_id:customerId}).name;**
** }**

** },**

this is reactive-method call from client
getCustomerName: (appointmentId)=>{

** return ReactiveMethod.call(“getCustomerNameByAppIdReactive”, appointmentId);**
** },**

this method working finely but getting the error in terminal as "Exception while invoking method ‘getCustomerNameByAppIdReactive’ { stack: 'TypeError: Cannot read property ‘customerId’ of undefined\n at [object Object].getCustomerNameByAppIdReactive (server/Functions/searchFunctions.js:167:20)\n at [object Object].methodMap.(anonymous function) "

Anyone if you had related with this issue ??


i solved it