Detox icon indicating copy to clipboard operation
Detox copied to clipboard

[RN-0.71 - iOS] The app has not responded to the network requests below: (id = -1000) isReady: {}

Open tarikfp opened this issue 2 years ago • 32 comments

What happened?

When running debug test script after a successful build, the app launches, then it gets stuck infinitely. (Note: Android is working fine, its only for iOS)

After timeout, it throws the following error:

image

What was the expected behaviour?

It should not get stuck, and process the test cases.

Was it tested on latest Detox?

  • [X] 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!

Simple react-native app, issue is reproducible in main branch https://github.com/tarikpnr/react-native-testing

In what environment did this happen?

Detox version: 20.1.3 React Native version: 0.71.2 Has Fabric (React Native's new rendering system) enabled: yes Node version: v16.19.1 Device model: iPhone 12 iOS version: 16.2 Xcode version: 14.2 Test-runner (select one): jest

Detox logs

Detox logs
paste logs here!

Device logs

Device logs
paste logs here!

More data, please!

Demonstration video (4x), starting from running yarn run detox test --configuration ios.sim.debug script.

https://user-images.githubusercontent.com/61876765/220784475-33760b13-a43e-4bc0-89b0-3b2bbba72c5a.mp4

tarikfp avatar Feb 22 '23 23:02 tarikfp

I will share the artifacts below, since I was not able to put logs due to the following restriction from github: There was an error posting your comment: Body is too long,

artifacts.zip

tarikfp avatar Feb 22 '23 23:02 tarikfp

Looks like there are some stuck/pending network requests in your app:

{"params":{"status":{"app_status":"busy","busy_resources":[{"name":"dispatch_queue","description":{"queue":"Main Queue (<OS_dispatch_queue_main: com.apple.main-thread>)","works_count":1}},{"name":"one_time_events","description":{"event":"Network Request","object":"URL: “https://fakestoreapi.com/img/61pHAEJ4NML._AC_UX679_.jpg”"}},{"name":"one_time_events","description":{"event":"Network Request","object":"URL: “https://fakestoreapi.com/img/71HblAHs5xL._AC_UY879_-2.jpg”"}},{"name":"one_time_events","description":{"event":"Network Request","object":"URL: “https://fakestoreapi.com/img/61mtL65D4cL._AC_SX679_.jpg”"}},{"name":"run_loop","description":{"name":"Main Run Loop"}},{"name":"one_time_events","description":{"event":"Network Request","object":"URL: “https://fakestoreapi.com/img/51eg55uWmdL._AC_UX679_.jpg”"}},{"name":"one_time_events","description":{"event":"React Native (bundle load)","object":null}}]},"messageId":1},"messageId":1,"type":"currentStatusResult"}

e.g. https://fakestoreapi.com/img/61pHAEJ4NML._AC_UX679_.jpg – they are never ending or something like that

noomorph avatar Feb 23 '23 09:02 noomorph

Why aren't the debug-sync logs shown - I wonder? Would have made what the problem is very clear.

d4vidi avatar Feb 23 '23 11:02 d4vidi

@d4vidi , the OP wrote why:

I will share the artifacts below, since I was not able to put logs due to the following restriction from github: There was an error posting your comment: Body is too long,

noomorph avatar Feb 23 '23 11:02 noomorph

I meant in the terminal. If they're in debug, would make sense to bump their log-level to info. WDYT?

d4vidi avatar Feb 23 '23 11:02 d4vidi

I meant in the terminal. If they're in debug, would make sense to bump their log-level to info. WDYT?

Strikes me odd: https://github.com/wix/Detox/blob/6145653d0077d5e406a48e539c3a3ea2f7d968bb/detox/src/client/Client.js#L265

Might have been an error that's triggered the debug "fallback" log instead, or - @tarikpnr have you by any chance actively disabled syncrhonization debugging?

d4vidi avatar Feb 23 '23 11:02 d4vidi

@d4vidi The synchronization was enabled. The OP mostly likely did not notice .

image

noomorph avatar Feb 23 '23 18:02 noomorph

@d4vidi @noomorph After your feedbacks regarding the issue, I've decided to take another shot:

  • The app is even simpler now, no any 3rd party call.

import React from 'react';
import {Button, Text, View} from 'react-native';
import {COMMON_STYLES} from './theme/common-styles';

const Counter = () => {
  const [counter, setCounter] = React.useState(0);

  return (
    <View style={COMMON_STYLES.flexCenter}>
      <Button
        testID="increase-btn"
        onPress={() => setCounter(prev => prev + 1)}
        title="Increase"
      />
      <Button
        testID="decrease-btn"
        onPress={() => setCounter(prev => prev - 1)}
        title="Decrease"
      />
      <Text testID="count-text">Count: {counter}</Text>
    </View>
  );
};

export default function App() {
  return <Counter />;
}

  • Corresponding e2e test file

describe('Example', () => {
  beforeAll(async () => {
    await device.launchApp({
      newInstance: true,
    });
  });

  beforeEach(async () => {
    await device.reloadReactNative();
  });

  test('complete app flow', async () => {
    await element(by.id('increase-btn')).tap();
  });
});

  • Demonstration

https://user-images.githubusercontent.com/61876765/220995428-0f973a55-6869-40b0-9ee5-97a73993952a.mp4

  • Artifacts file

ios.sim.debug.2023-02-23 18-07-38Z.zip

  • Reproducible source code

Created a new branch called test/ios-e2e-debug. https://github.com/tarikpnr/react-native-testing/tree/test/ios-e2e-debug


Unfortunately, it throws the same error, from what I can see it gets busy with event "React Native (bundle load)":

  data: {
    "params": {
      "status": {
        "busy_resources": [
          {
            "name": "one_time_events",
            "description": {
              "event": "React Native (bundle load)",
              "object": null
            }
          },
          {
            "name": "run_loop",
            "description": {
              "name": "Main Run Loop"
            }
          },
          {
            "name": "dispatch_queue",
            "description": {
              "queue": "Main Queue (<OS_dispatch_queue_main: com.apple.main-thread>)",
              "works_count": 1
            }
          }
        ],
        "app_status": "busy"
      },
      "messageId": 1
    },
    "messageId": 1,

tarikfp avatar Feb 23 '23 18:02 tarikfp

@tarikpnr thanks for taking the extra-mile, it will definitely prove helpful.

d4vidi avatar Feb 23 '23 20:02 d4vidi

@tarikpnr I've put in a serious effort, trying to run thereact-native-testing project on iOS. I've managed to overcome some issues (ruby + pod installations). Eventually stopped at getting this from metro when bundling the app:

error: ReferenceError: SHA-1 for file /Users/<omitted>nvm/versions/node/v14.18.2/lib/node_modules/react-native/node_modules/metro-runtime/src/polyfills/require.js (/Users/<omitted>nvm/versions/node/v14.18.2/lib/node_modules/react-native/node_modules/metro-runtime/src/polyfills/require.js) is not computed.
         Potential causes:
           1) You have symlinks in your project - watchman does not follow symlinks.
           2) Check `blockList` in your metro.config.js and make sure it isn't excluding the file path.

Anyways would you be able to try running that project with RN .70 instead of .71? I think the problem might lie there.

d4vidi avatar Feb 23 '23 21:02 d4vidi

Update: I've managed to get passed that. Bottom line is that while the images download sure is on the slow side, the test ultimately passes (i.e. your problem does not reproduce). I think you might like to try to increase the timeout (120000ms may not be enough), on account of the download's slowness.

d4vidi avatar Feb 23 '23 21:02 d4vidi

@d4vidi Thanks for your efforts. I have actually updated the repo by creating the new branch, as I also mentioned here you probably tested it on main branch which has third party API call. It'd be perfect if you switch to the branch called as ios-e2e-debug and test it from there. (Not sure tho, might not necessarily needed since you already managed to run it in main. But just curious to see if it is running on that branch too, as I was not able to run the test in a simple counter app, and we would make sure to determine whether its related to download's slowness or not by doing this way.)

And, have you done any changes to the repo to make it run? If not, then I doubt it is maybe sort of environment issue ?

tarikfp avatar Feb 23 '23 22:02 tarikfp

TL&DR

It will not work in new architecture (when you see fabric: true in metro console) (still need confirmation)


Attempts

I ended up resetting everything related to iOS using react-native-clean-project, and having this new Podfile.lock seems to fix the issue.

Considering react-native-clean-project using the typical pod install but not bundle install && RCT_NEW_ARCH_ENABLED=1 bundle exec pod install which means it will end up setting up an environment without fabric or in other words, new architecture is NOT enabled.

According to docs, determining whether the new architecture is in use or not is simply checking fabric:trueoption.

Double-checked through the metro console, notice below there is no fabric: true option. And it did run the tests properly when I tried.

image

In contrast, fabric option was enabled in the initial video that I shared. See below:

image

I assume it initializes project with fabric by default using ,npx react-native@latest init AwesomeProjectcommand. Then, in the very next pod install it does revert fabric. If you want to keep fabric in the project, The default pod-install script should be the following as the docs suggest:

"scripts": {
  "pod-install": "RCT_NEW_ARCH_ENABLED=1 bundle exec pod install"
}

@d4vidi Most probably it was the case for you as well, there is a high chance that you may have initialized the project without fabric, therefore you were not able to reproduce the error I faced, just guessing at the moment, that's the reason it still needs confirmation.

tarikfp avatar Feb 24 '23 00:02 tarikfp

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[bot] avatar Apr 12 '23 18:04 stale[bot]

I'm facing the same issue, that all tests won't start when using fabric. They time out with this error

The app has not responded to the network requests below:
  (id = -1000) isReady: {}

Unresponded network requests might result in timeout errors in Detox tests.

sgabriel avatar Apr 19 '23 07:04 sgabriel

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[bot] avatar May 20 '23 11:05 stale[bot]

I'm facing the same issue, that all tests won't start when using fabric. They time out with this error

The app has not responded to the network requests below:

(id = -1000) isReady: {}

Unresponded network requests might result in timeout errors in Detox tests.

Screenshot 2023-06-08 at 12 48 57 PM

Numan-Munir avatar Jun 08 '23 07:06 Numan-Munir

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[bot] avatar Jul 15 '23 00:07 stale[bot]

Not stale, facing the same issue.

badsyntax avatar Jul 20 '23 15:07 badsyntax

I am also facing the same issue on native-ios app

sam060584 avatar Jul 21 '23 18:07 sam060584

I am also facing the same issue on native-ios app

My issue has been resolved. I was using the "import * as Progress from "react-native-progress";" library to implement a progress bar. However, I have now commented it out.

Numan-Munir avatar Jul 21 '23 19:07 Numan-Munir

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[bot] avatar Sep 16 '23 21:09 stale[bot]

is there any workaround for this ?

nmongiya avatar Oct 16 '23 03:10 nmongiya

I'm seeing the exact same issue with a React Native prototype (Turbo Modules (C++), New Architecture). Triggering the tests via eas build:

[ON_BUILD_SUCCESS_HOOK] 17:04:29.459 detox[43533] i The app has not responded to the network requests below:
[ON_BUILD_SUCCESS_HOOK]   (id = -1000) isReady: {}

Can we have an official word on whether this the New Architecture is supported/not supported/it's some other issue?

timmyjose avatar Jan 19 '24 11:01 timmyjose

I'm seeing the exact same issue with a React Native prototype (Turbo Modules (C++), New Architecture). Triggering the tests via eas build:

[ON_BUILD_SUCCESS_HOOK] 17:04:29.459 detox[43533] i The app has not responded to the network requests below:
[ON_BUILD_SUCCESS_HOOK]   (id = -1000) isReady: {}

Can we have an official word on whether this the New Architecture is supported/not supported/it's some other issue?

Hey @timmyjose, we do not support turbo modules ATM however we're aiming to support that soon. No official ETA unfortunately.

asafkorem avatar Jan 22 '24 16:01 asafkorem

is there any workaround for this ?

Hey @nmongiya, can you please elaborate what issue are you facing (provide logs or any information that might be useful)? The error on the issue title is quite general and might indicate on a different issue than yours.

asafkorem avatar Jan 22 '24 16:01 asafkorem

Hey @asafkorem, thank you for confirming that. 🙏 It's a bit unfortunate, but at least now we know that it's not an issue in our setup! We're now looking into using the Old Architecture (non Turbo Modules) in the meantime, and when support for Turbo Modules is available (hopefully soon!), we'll probably migrate back.

timmyjose avatar Jan 23 '24 04:01 timmyjose

following here for turbo module support

skylarbarrera avatar Jan 26 '24 16:01 skylarbarrera

Following for turbo

walmat avatar Jan 26 '24 18:01 walmat

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[bot] avatar Mar 17 '24 08:03 stale[bot]