Facedetection stopped working with "TypeError: Cannot read property 'detectFaces' of undefined"

Please provide the following:

  1. SDK Version: facedetector 12.1.1
  2. Platforms(Android/iOS/web/all): expo running on iOS
  3. Add the appropriate “Tag” based on what Expo library you have a question on.

FaceDetection was working perfectly fine, but now it fails with “TypeError: Cannot read property ‘detectFaces’ of undefined”.

The code I was using does exactly this, and worked fine for 3 days, and suddenly now it never works at all:

const result = await ImagePicker.launchImageLibraryAsync({
          mediaTypes: ImagePicker.MediaTypeOptions.Images,
          allowsEditing: true,
          aspect: [3, 4],
          quality: 1,
        });
        if (!result.canceled) {
          const image = result.assets[0];
FaceDetector.detectFacesAsync(image.uri, {
      mode: FaceDetector.FaceDetectorMode.fast,
      detectLandmarks: FaceDetector.FaceDetectorLandmarks.none,
      runClassifications: FaceDetector.FaceDetectorClassifications.none,
      minDetectionInterval: 300,
      tracking: false,
    }).then((detectionResult) => { ... });

^^ This alone fails with the error, every time.

For what it’s worth, this is the stack trace I get:

TypeError: Cannot read property 'detectFaces' of undefined
    at ?anon_0_ (http://192.168.1.108:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=ios&dev=true&hot=false:660631:37)
    at next (native)
    at asyncGeneratorStep (http://192.168.1.108:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=ios&dev=true&hot=false:4644:26)
    at _next (http://192.168.1.108:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=ios&dev=true&hot=false:4663:29)
    at anonymous (http://192.168.1.108:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=ios&dev=true&hot=false:4668:14)
    at tryCallTwo (/private/var/folders/yw/6bx918xn4671rggfcdxz7fph0000gn/T/hermes/build_iphoneos/lib/InternalBytecode/InternalBytecode.js:61:9)
    at doResolve (/private/var/folders/yw/6bx918xn4671rggfcdxz7fph0000gn/T/hermes/build_iphoneos/lib/InternalBytecode/InternalBytecode.js:216:25)
    at Promise (/private/var/folders/yw/6bx918xn4671rggfcdxz7fph0000gn/T/hermes/build_iphoneos/lib/InternalBytecode/InternalBytecode.js:82:14)
    at anonymous (http://192.168.1.108:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=ios&dev=true&hot=false:4660:25)
    at apply (native)
    at detectFacesAsync (http://192.168.1.108:19000/node_modules%5Cexpo%5CAppEntry.bundle?platform=ios&dev=true&hot=false:660626:35)

And an example URI of what I’m getting is: file:///var/mobile/Containers/Data/Application/5CF0B688-C002-4EEC-86EF-80906DFCD282/Library/Caches/ExponentExperienceData/%2540[[--my name--]]%252F[[]--my app--]/ImagePicker/3FA62073-39E5-481B-9189-BEC581820987.jpg

It seems to work from other clients.
Just not from my client from any user account.

I believe I must have hit some API threshold on Google Mobile Vision (since that product is discontinued by Google anyway…).

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.