react-native-vision-camera: šŸ› Frame Processor threw an error: Value is undefined, expected an Object

What were you trying to do?

I’m trying to integrate this community plugin : https://github.com/rodgomesc/vision-camera-code-scanner But I’m unable to make it work on iOS. It works great on Android though. I have tried other community plugin but the same error appear. In fact event a frame processor function with no code in it makes the error appear. I’ve also tried different version react-native-vision-camera, since some changes has been made since the last version of vision-camera-code-scanner.

Reproduceable Code

const ScanBarCodeScreen = (props: NavigationProps) => {
  const [hasPermission, setHasPermission] = useState(false)
  const devices = useCameraDevices()
  const device = devices.back

  const frameProcessor = useFrameProcessor((frame) => {
    'worklet'
    console.log('hello')
  }, [])

  const isFocused = useIsFocused()

  useEffect(() => {
    (async () => {
      const status = await Camera.requestCameraPermission()
      setHasPermission(status === 'authorized')
    })()
  }, [])

  return (
    <>
      <StatusBar backgroundColor={Theme.Color.White} barStyle="dark-content" />
      <View
        style={{
          flex: 1,
          flexDirection: 'column',
          backgroundColor: 'black'
        }}
      >
        <SafeAreaView
          style={{
            flex: 1,
            justifyContent: 'space-between',
            alignItems: 'center'
          }}
        >
          {device != null && hasPermission && (
            <Camera
              style={StyleSheet.absoluteFill}
              device={device}
              isActive={isFocused}
              frameProcessor={frameProcessor}
              frameProcessorFps={1}
            />
          )}
        </SafeAreaView>
      </View>
    </>
  )
}

What happened instead?

As soon as I arrive on my screen, and after giving permission to use the device camera, I get the error Frame Processor threw an error: Value is undefined, expected an Object at every refresh.

The app does not crash but I obviously cannot use the frame processor.

Relevant log output

FrameProcessorBindings: Creating Runtime Manager...
FrameProcessorBindings: Runtime Manager created!
FrameProcessorBindings: Installing Frame Processor plugins...
FrameProcessorBindings: Installing Frame Processor plugin "__scanCodes"...
FrameProcessorBindings: Installing Frame Processor plugin "__labelImage"...
FrameProcessorBindings: Frame Processor plugins installed!
FrameProcessorBindings: Installing Frame Processor Bindings for Bridge...
FrameProcessorBindings: Installing global functions...
FrameProcessorBindings: Finished installing bindings.
[javascript] Running "TitrePrepayesApp" with {"rootTag":1,"initialProps":{}}
[native] [GESTURE HANDLER] Initialize gesture handler for root view <RCTRootContentView: 0x104e19640; reactTag: 1; frame = (0 0; 768 1024); gestureRecognizers = <NSArray: 0x282a4a220>; layer = <CALayer: 0x28243d5e0>>
[MC] System group container for systemgroup.com.apple.configurationprofiles path is /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
[MC] Reading from public effective user settings.
[Common] _BSMachError: port b003; (os/kern) invalid capability (0x14) "Unable to insert COPY_SEND"
[javascript] 'Frameporcccc', [Function]
FrameProcessorBindings: Setting new frame processor...
FrameProcessorBindings: Adapting Shareable value from function (conversion to worklet)...
FrameProcessorBindings: Successfully created worklet!
FrameProcessorBindings: Converting worklet to Objective-C callback...
FrameProcessorBindings: Frame processor set!
[javascript] Frame Processor threw an error: Value is undefined, expected an Object
[javascript] Frame Processor threw an error: Value is undefined, expected an Object
[javascript] Frame Processor threw an error: Value is undefined, expected an Object

Device

iPad mini 2 on iOS 12.5.5

VisionCamera Version

2.11.2 ; 2.11.1 ; 2.9.4

Additional information

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 4
  • Comments: 34 (7 by maintainers)

Commits related to this issue

Most upvoted comments

ok it’s working now, I did the following:

  1. npm start – --reset-cache
  2. cd android
  3. ./gradlew clean

that did it. I previously tried clean without resetting the cache but that didn’t help at all. npm start – --reset-cache as suggested by @mrousavy seems to solve it

Yes, I need that function. In the future I have an alternative to Reanimated ready, so stay tuned

Does https://github.com/mrousavy/react-native-vision-camera/pull/698 fix the issue for you? Try rebuilding everything and cleaning cache (especially metro cache)

follow the answer in this link to solve the issue- stackoverflow link

Guys can anyone help me out am I having this error below, ERROR Frame Processor threw an error: scanBarcodes is not a function. (In ā€˜scanBarcodes(frame,[BarcodeFormat.QR_CODE],{checkInverted:true})’, ā€˜scanBarcodes’ is undefined)

@saidybarry Hello, have you found any solution for this problem?

@thelastwizardOC nope I wasn’t able to find a solution, I did end up switching to a different package.

to which package you switched?

@thelastwizardOC Mhmm actually i was trying to use it in relation to another package to implement QR-code scanning, so after getting stuck with react native vision camera i decided to up for ā€œreact-native-qrcode-scannerā€.