title: Face recognition in javascript using face api getting "Uncaught (in promise) TypeError: Cannot read property 'descriptor' of undefined"
body: <p>Facing this issue in the implementation of face recognition on the webcam camera for the browser using node js for the web application. This error only comes when I add more than 1 name in my labels in loadLabeledImages() function. If I have one name, it works perfectly fine. Beginner here and I have been getting the same error for days now</p>
  
  <p>If I log Resized detections and detections, I get this:
  <a href="https://i.stack.imgur.com/ckDQy.png" rel="nofollow noreferrer">Error after logging detections and resized detections</a></p>
  
  <p>Any help is appreciated, thank you so much!</p>
  
  <pre><code>setInterval(async () =&gt; {
  const detections = await faceapi.detectSingleFace(video).withFaceLandmarks().withFaceDescriptor()
  const resizedDetections = faceapi.resizeResults(detections, displaySize)
  canvas.getContext('2d').clearRect(0, 0, canvas.width, canvas.height)
  faceapi.draw.drawFaceLandmarks(canvas, resizedDetections)
  this.labeledFaceDescriptors = await this.loadLabeledImages()
  const faceMatcher = new faceapi.FaceMatcher(labeledFaceDescriptors, 0.6)
  const results = resizedDetections.map(d =&gt; faceMatcher.findBestMatch(d.descriptor))
  results.forEach((result, i) =&gt; {
    const box = resizedDetections[i].detection.box
    const drawBox = new faceapi.draw.DrawBox(box, {label: result.toString()})
    drawBox.draw(canvas) 
  })
  
  }, 100) 
  })
  
  function loadLabeledImages() {
  
  try{
  const labels = ['Jane', 'Alex']
  
  return Promise.all(
    labels.map(async label =&gt; {
      const descriptions = []
      for (let i = 1; i &lt;= 3; i++) {
        const img = await faceapi.fetchImage(`public/img/${label}/${i}.jpg`)
        const detections = await faceapi.detectSingleFace(img).withFaceLandmarks().withFaceDescriptor()
        descriptions.push(detections.descriptor)
      }
  
      return new faceapi.LabeledFaceDescriptors(label, this.descriptions)
    })
  )
  
      }
     catch(err){
       console.log(err)
       }
  
         }
  </code></pre>