react-native-camera-kit icon indicating copy to clipboard operation
react-native-camera-kit copied to clipboard

v14.0.0-beta13: Unsupported top level event type "onError" dispatched, js engine: hermes

Open Overtorment opened this issue 2 years ago • 3 comments

Describe the bug

Trying to use latest beta v14.0.0-beta13, previous version was working ok. When running e2e on CI, app crashes when navigating to the screen with camera (and clicking a button thats overlay on that screen?)

I'm trying to reproduce it locally currently, but on CI it reproduces pretty reliably.

Adding onError property doesnt fix it.

Desktop (please complete the following information):

  • OS: macos-latest on Github Actions
  • java temurin/11

Smartphone (please complete the following information):

  • android api 31
  • emulator-options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -camera-back none -camera-front none -partition-size 2047
  • emulator arch: x86_64

Additional context

  • detox 20.13.1

attaching full device log as was provided by detox, but looks like the relevant part of the log is this:

10-21 19:07:53.847  8261  8261 E CameraKit: Use case binding failed
10-21 19:07:53.847  8261  8261 E CameraKit: java.lang.IllegalArgumentException: Provided camera selector unable to resolve a camera for the given use case
10-21 19:07:53.847  8261  8261 E CameraKit: 	at androidx.camera.lifecycle.ProcessCameraProvider.bindToLifecycle(ProcessCameraProvider.java:470)
10-21 19:07:53.847  8261  8261 E CameraKit: 	at androidx.camera.lifecycle.ProcessCameraProvider.bindToLifecycle(ProcessCameraProvider.java:360)
10-21 19:07:53.847  8261  8261 E CameraKit: 	at com.rncamerakit.CKCamera.bindCameraUseCases(CKCamera.kt:321)
10-21 19:07:53.847  8261  8261 E CameraKit: 	at com.rncamerakit.CKCamera.setupCamera$lambda$2(CKCamera.kt:225)
10-21 19:07:53.847  8261  8261 E CameraKit: 	at com.rncamerakit.CKCamera.$r8$lambda$MDVDuNxMjHGB3fwL590m7OnQ_Qg(Unknown Source:0)
10-21 19:07:53.847  8261  8261 E CameraKit: 	at com.rncamerakit.CKCamera$$ExternalSyntheticLambda2.run(Unknown Source:4)
10-21 19:07:53.847  8261  8261 E CameraKit: 	at android.os.Handler.handleCallback(Handler.java:938)
10-21 19:07:53.847  8261  8261 E CameraKit: 	at android.os.Handler.dispatchMessage(Handler.java:99)
10-21 19:07:53.847  8261  8261 E CameraKit: 	at android.os.Looper.loopOnce(Looper.java:201)
10-21 19:07:53.847  8261  8261 E CameraKit: 	at android.os.Looper.loop(Looper.java:288)
10-21 19:07:53.847  8261  8261 E CameraKit: 	at android.app.ActivityThread.main(ActivityThread.java:7839)
10-21 19:07:53.847  8261  8261 E CameraKit: 	at java.lang.reflect.Method.invoke(Native Method)
10-21 19:07:53.847  8261  8261 E CameraKit: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
10-21 19:07:53.847  8261  8261 E CameraKit: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
10-21 19:07:54.027  8261  8268 I llet.bluewalle: Background young concurrent copying GC freed 365796(15MB) AllocSpace objects, 47(1700KB) LOS objects, 45% free, 19MB/35MB, paused 2.062ms total 101.417ms
10-21 19:07:54.064  8261  8335 E ReactNativeJS: Error: Unsupported top level event type "onError" dispatched, js engine: hermes
--------- beginning of crash
10-21 19:07:54.070  8261  8339 E AndroidRuntime: FATAL EXCEPTION: mqt_native_modules
10-21 19:07:54.070  8261  8339 E AndroidRuntime: Process: io.bluewallet.bluewallet, PID: 8261
10-21 19:07:54.070  8261  8339 E AndroidRuntime: com.facebook.react.common.JavascriptException: Error: Unsupported top level event type "onError" dispatched, js engine: hermes, stack:
10-21 19:07:54.070  8261  8339 E AndroidRuntime: extractEvents@1:399318
10-21 19:07:54.070  8261  8339 E AndroidRuntime: anonymous@1:345713
10-21 19:07:54.070  8261  8339 E AndroidRuntime: batchedUpdatesImpl@1:405013
10-21 19:07:54.070  8261  8339 E AndroidRuntime: batchedUpdates@1:345363
10-21 19:07:54.070  8261  8339 E AndroidRuntime: _receiveRootNodeIDEvent@1:345636
10-21 19:07:54.070  8261  8339 E AndroidRuntime: receiveEvent@1:399516
10-21 19:07:54.070  8261  8339 E AndroidRuntime: __callFunction@1:136423
10-21 19:07:54.070  8261  8339 E AndroidRuntime: anonymous@1:134775
10-21 19:07:54.070  8261  8339 E AndroidRuntime: __guard@1:135728
10-21 19:07:54.070  8261  8339 E AndroidRuntime: callFunctionReturnFlushedQueue@1:134733
10-21 19:07:54.070  8261  8339 E AndroidRuntime: 
10-21 19:07:54.070  8261  8339 E AndroidRuntime: 	at com.facebook.react.modules.core.ExceptionsManagerModule.reportException(ExceptionsManagerModule.java:72)
10-21 19:07:54.070  8261  8339 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
10-21 19:07:54.070  8261  8339 E AndroidRuntime: 	at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
10-21 19:07:54.070  8261  8339 E AndroidRuntime: 	at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:188)
10-21 19:07:54.070  8261  8339 E AndroidRuntime: 	at com.facebook.jni.NativeRunnable.run(Native Method)
10-21 19:07:54.070  8261  8339 E AndroidRuntime: 	at android.os.Handler.handleCallback(Handler.java:938)
10-21 19:07:54.070  8261  8339 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:99)
10-21 19:07:54.070  8261  8339 E AndroidRuntime: 	at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
10-21 19:07:54.070  8261  8339 E AndroidRuntime: 	at androidx.test.espresso.base.Interrogator.loopAndInterrogate(Interrogator.java:14)
10-21 19:07:54.070  8261  8339 E AndroidRuntime: 	at androidx.test.espresso.base.LooperIdlingResourceInterrogationHandler$2.run(LooperIdlingResourceInterrogationHandler.java:3)
10-21 19:07:54.070  8261  8339 E AndroidRuntime: 	at android.os.Handler.handleCallback(Handler.java:938)
10-21 19:07:54.070  8261  8339 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:99)
10-21 19:07:54.070  8261  8339 E AndroidRuntime: 	at android.os.Looper.loopOnce(Looper.java:201)
10-21 19:07:54.070  8261  8339 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:288)
10-21 19:07:54.070  8261  8339 E AndroidRuntime: 	at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:228)
10-21 19:07:54.070  8261  8339 E AndroidRuntime: 	at java.lang.Thread.run(Thread.java:920)
10-21 19:07:54.071  8261  8339 E DetoxCrashHandler: Crash detected!!! thread=mqt_native_modules (72)

device.log

Overtorment avatar Oct 22 '23 12:10 Overtorment

Provided camera selector unable to resolve a camera for the given use case means Android didn't find the requested camera on your device

You initialize the emulator saying you don't want any camera -camera-back none -camera-front none

You should set the one you use to emulated, so your e2e will go through, and will be more realistic.

Not saying the lib should crash here, but devices without camera are fairly rare. It was probably caught on the v13.

DavidBertet avatar Dec 21 '23 01:12 DavidBertet

The error was just logged on v13, and is now forwarded on v14

https://github.com/teslamotors/react-native-camera-kit/commit/73bd920ca46bdaa16c8254820728c50c900c682e

I took a second look, and we missed a line. I'll push a PR to fix it

Thanks @Overtorment for raising the issue. Using -camera-back emulated/virtualscene still applies in your case of e2e testing.

DavidBertet avatar Dec 21 '23 03:12 DavidBertet

I thought that "camera none" makes it a bit more performant, we are not actually scanning anything in e2e tests on CI

Overtorment avatar Dec 24 '23 22:12 Overtorment