Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to call native module while running detox build #4050

Closed
2 tasks done
jeroen-van-dijk opened this issue May 10, 2023 · 4 comments
Closed
2 tasks done

Unable to call native module while running detox build #4050

jeroen-van-dijk opened this issue May 10, 2023 · 4 comments

Comments

@jeroen-van-dijk
Copy link

jeroen-van-dijk commented May 10, 2023

What happened?

Hi! While running a detox test I'm getting this message when invoking a native module. The native module does a network fetch request. I'm wondering why this request is failing within the detox build why it runs perfectly fine within a regular build.

Exception 'Attempted to invoke method             -[NativeModuleName myMethod:withResolver:withRejecter:] on a module of class NativeModuleName(__detox_sync_URLSessionDelegateProxy)' was thrown while invoking myMethod on target NativeModuleName with params (...

The callstack lists an issue with DetoxSync. What does that do and can I disable that?

callstack: (
	0   CoreFoundation                      0x00000001158b78cb __exceptionPreprocess + 242
	1   libobjc.A.dylib                     0x000000010eb0fba3 objc_exception_throw + 48
	2   Foundation                          0x0000000113087521 -[NSMutableDictionary(NSMutableDictionary) classForCoder] + 0
	3   AppName                               0x0000000101749f91 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 753
	4   AppName                               0x000000010174eb1a _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicEiN12_GLOBAL__N_117SchedulingContextE + 1402
	5   AppName                               0x000000010174e3cc _ZZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEiENK3$_0clEv + 156
	6   AppName                               0x000000010174e329 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 25
	7   DetoxSync                           0x000000014c3c2e47 ____detox_sync_dispatch_wrapper_block_invoke + 23
	8   libdispatch.dylib                   0x0000000112b4a7fb _dispatch_call_block_and_release + 12
	9   libdispatch.dylib                   0x0000000112b4ba3a _dispatch_client_callout + 8
	10  libdispatch.dylib                   0x0000000112b53346 _dispatch_lane_serial_drain + 949
	11  libdispatch.dylib                   0x0000000112b53fe3 _dispatch_lane_invoke + 400
	12  libdispatch.dylib                   0x0000000112b60b46 _dispatch_workloop_worker_thread + 870
	13  libsystem_pthread.dylib             0x00000001168eefd0 _pthread_wqthread + 326
	14  libsystem_pthread.dylib             0x00000001168edf57 start_wqthread + 15
)

Was it tested on latest Detox?

  • I have tested this issue on the latest Detox release and it still reproduces.

Did your test throw out a timeout?

In what environment did this happen?

Detox version: 20.7.1
React Native version: 0.69.6
Has Fabric (React Native's new rendering system) enabled: (yes/no)
Node version:
Device model:
iOS version: 16.1
macOS version:
Xcode version:
Test-runner (select one): jest / other

@asafkorem
Copy link
Contributor

@jeroen-van-dijk thanks for the report. It's hard to understand what happened here. It doesn't seems like a Detox error, DetoxSync is on the stack trace just as a wrapper for something else.

I can help to debug it to understand this issue better, if you'll help me with a minimal reproduction for this bug.

@jeroen-van-dijk
Copy link
Author

Hi Asaf,

Thanks for the response! I guess it is a sync/timing issue while invoking our custom native module. I've created a workaround by just using JS fetch to get some data which works for now.

How can I detect inside the react native codebase if the app is running a detox test? Is there any kind of flag I can look at? I've found isTesting inside react-native Platform however it remains to false while running my detox test

@stale
Copy link

stale bot commented Jun 17, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you believe the issue is still relevant, please test on the latest Detox and report back.

Thank you for your contributions!

For more information on bots in this repository, read this discussion.

@stale stale bot added the 🏚 stale label Jun 17, 2023
@stale
Copy link

stale bot commented Jul 15, 2023

The issue has been closed for inactivity.

@stale stale bot closed this as completed Jul 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants