Detox: Backend API has valid response, but Detox is not getting the response (with Flipper installed)

What happened?

I am running Detox on iOS, with backend (expressJS) running in localhost separately

I logged both the backend and frontend response body

When I run the detox test, the backend gave valid response body, but the frontend receives it undefined, even though the statusCode is 200

When i run without detox test, the network request is working fine.

I am not sure what am I missing to make the sure the network request body is not missing along the way…

What was the expected behaviour?

When backend API gave valid response, the frontend should receive the same response

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?

Help us reproduce this issue!

Create a sample RN app, expressJS which returns some random response

Configure RN with detox and then have RN make network request to the expressJS app

Run the detox test

In what environment did this happen?

Detox version: 19.4.3 React Native version: 0.67 Node version: 16 Device model: iphone 12 iOS version: 15 macOS version: monterey Xcode version: 13.3.1 Test-runner (select one): jest-circus

Detox logs

Detox logs
paste logs here!

Device logs

no logs

More data, please!

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 25 (10 by maintainers)

Most upvoted comments

This PR resolves the issue: https://github.com/wix/Detox/pull/3499 I’ll release a patch version soon.

We have the same problem, that when detox starts the app on the simulator none of the HTTP responses have a body and JSON.parse('') fails, so it’s not even a network error.

When we write a detox test, that launches the app and wait a few seconds at first, we can manually close the app (really close by swiping away) and start the app again by clicking on it, everything starts to work and the test can run. This workaround is not possible with automatically terminate and relaunch the app. So this might be a hint, that the launchApp(..) makes the app start in a bad state with flipper, while starting the app by clicking on it not.

We currently fixed it by commenting out # use_flipper!(..), but we should better try the flipper downgrade.

If you need more information, please reach out.

Commenting on behalf of @finalight, tried with flipper version 0.128.0 and network requests are able to be made. The recent releases of flipper removed rsockets ref: https://github.com/facebook/flipper/issues/3554 due to Xcode 13.3. If this is the problem we might not be able to run detox tests in debug mode.

Great @josephk96! Thanks for the update.

Please try to upgrade your Detox version to 19.8.1 (latest version ATM), then upgrade your Flipper version.

Hi @asafkorem , after upgrading Detox to 19.8.1 and Flipper to 0.155.0, everything is now working as expected. Thanks for the fix!

Please try to upgrade your Detox version to 19.8.1 (latest version ATM), then upgrade your Flipper version.

Confirming the comment above https://github.com/wix/Detox/issues/3341#issuecomment-1115846128 (thank you @hongkheng !)

Fixing my Flipper version to 0.128.0 has resolved the issue for me.

hey everyone, just wanted to chime in and say that my team has been experiencing the exact same issue. like @finalight said, this bug has to do with flipper.

we are running react-native@0.67.4 and had flipper@0.142.0. bumping down to 0.99.0 fixes the issue for us. for reference, we no longer reference a specific flipper version in our podfile – see https://github.com/react-native-community/rn-diff-purge/blob/release/0.67.4/RnDiffApp/ios/Podfile#L24

Please provide and check your logs using --loglevel =trace to get Detox port while running, also what’s the backend port you’re trying to communicate with?

i did a trace log but it might not be helpful, i will do it again later on my backend port is on 3001, the detox seems to be using the port in the 50xxx range, as what I’ve checked using flipper network (yes i have flipper installed)

i am not sure what you meant by receve messages outside the app…

i am using axios to make network request, and I am not mocking the network request