react-native-vision-camera: π Error when using frameProcessor on iOS (V3 - RN 0.72.4)
Whatβs happening?
I want to use the frame processor on iOS, but I get this error
Reproduceable Code
<Camera
style={{flex: 1}}
device={device}
isActive={isFocused}
onError={onError}
onInitialized={onInitialized}
photo={true}
video={true}
ref={camera}
enableZoomGesture={true}
frameProcessor={frameProcessor}
/>
Relevant log output
libc++abi: terminating with uncaught exception of type facebook::jsi::JSINativeException: Compiling JS failed: 1:1:invalid empty parentheses '( )' Buffer size 3 starts with: 280a29
Camera Device
No response
Device
iPhone X
VisionCamera Version
3.0.0
Can you reproduce this issue in the VisionCamera Example app?
- I can reproduce the issue in the VisionCamera Example app.
Additional information
- I am using Expo
- I have enabled Frame Processors (react-native-worklets-core)
- I have read the Troubleshooting Guide
- I agree to follow this projectβs Code of Conduct
- I searched for similar issues in this repository and found none.
About this issue
- Original URL
- State: closed
- Created 10 months ago
- Reactions: 6
- Comments: 51 (15 by maintainers)
I have seen the log message
libc++abi: terminating with uncaught exception of type facebook::jsi::JSINativeException: Compiling JS failed: 1:1:invalid empty parentheses '( )' Buffer size 3 starts with: 280a29
in XCode for React Native0.72.4
as mentioned. Quite annoying as it prevents custom frame processors.The error appears to be in the
react-native-worklets-core
version0.2.0
package. Seems like properties on the jsi::Function have changed to a double underscore, as observed when outputting each available property from the decorated worklet. Other properties are references correctly, however thePropNameWorkletClosure
remained to be_closure
and not__closure
.Given that
_closure
does not exist, we can never retrieve thecode
that we need. As observed here.Anyway, here is the patch for
patch-package
to resolve it. It is a renaming of_closure
to__closure
.react-native-worklets-core+0.2.0.patch
@fedpre Here is a workaround patch. Not sure of the consequences
Thanks to @SimonJakubowski
react-native-worklets-core+0.2.1.patch
the issue still exists in release build. Dev build is working!
if hermes is enabled the app crashes with
libc++abi: terminating with uncaught exception of type facebook::jsi::JSINativeException: Compiling JS failed: 1:1:invalid empty parentheses '( )' Buffer size 3 starts with: 280a29
if hermes is disables the app does not crash, but throw the following error when using a frameprocessor
[javascript] Frame Processor threw an error: Unexpected token ')'
In the release build
WKTJsiWorklet.h Line 277
locationProp
is undefined and in the dev build it is defined. I have no idea how to resolve this.Workaround to get a running release build is to comment out all lines above in
WKTJsiWorklet.h
This can happen without reanimated when you forget to add the plugin
'react-native-worklets-core/plugin'
to yourbabel.config.js
and tries to use a frameProcessor.Only happens in iOS release build, not debug build for me.
This is related: https://github.com/mrousavy/react-native-vision-camera/issues/1843#issuecomment-1766159431
Hereβs a sum up by @bglgwyng:
RNVC 3.2.2 + Reanimated 3.3.0 β Functioning properly RNVC 3.2.2 + Reanimated 3.5.4 β Caused a crash RNVC 3.4.0 + Reanimated 3.3.0 β Caused a crash RNVC 3.4.0 + Reanimated 3.5.4 β Functioning properly
I also see this issue:
libc++abi: terminating due to uncaught exception of type facebook::jsi::JSINativeException: Compiling JS failed: 1:1:invalid empty parentheses β( )β Buffer size 3 starts with: 280a29
Downgrading
react-native-reanimated
to version~3.4.2
fixed it for me.This might be a Reanimated issue. Can you guys reproduce this without reanimated?
react-reanimated 3.4.0 and 3.4.1 have some problems. upgrade react-reanimated
I have the same problem on Android too, but downgrading RN did not work for me π
@fedpre I ran into the same crash issue downgraded RN to 0.72.3 and worked fine. Used the same versions as vision-camera example app.