'Why do my https requests hang for several minutes?

I make https request from a react native app. Sometimes the requests hang for about 2 minutes (no reject, no resolve). Here are some symptoms:

  • It looks like it happens only on some network (4G works, wifi doesn't)
  • It comes and goes (can work 100 times, then stop working)
  • looks like https fails when http succeeds
  • The same requests work perfectly in Chrome (same device, same network)
  • I use react native with expo
  • tried fetch & axios

What else can I check?



Solution 1:[1]

You can try axios or fetch with some timeout value and can verify if you are getting timeout error this means request not gettng fulfilled within defined time and there can be plenty of reasons not specific to react-native.

Sometime with simulator/virtual devices we face issue like network calls not working properly due to low memory configuration or other network related issues. You can also try to reproduce same in real device and relase version.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ankur Gahtori