question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fetching api response too slow when debugging mode is off

See original GitHub issue

Description: Good evening guys, I am having an issue on my project on both android and iOS:

When i am using the app on debugging mode ON fetching data from api working pretty well, and getting the response just takes 2 seconds; When i am using the app debugging mode OFF fetching data from api takes more than 11 seconds, i wonder why, and its first time face this issue. I tried both Axios and Fetch both comes with the same results. Have anyone faces this issue before? Bonus: Postman and web-app getting response so fast like on debugging mode is ON

Code Example:

export const find = async (query: IFindQuery) => {
  const { apiServer } = getConfig();
  const queryString = stringify(query, {
    arrayFormat: 'brackets',
    encode: false,
  });
  const url = `${apiServer}/radiks/models/find?${queryString}`;
  const response = await fetch(url);
  return await response.json();
};

React Native version:

System: OS: macOS 10.15.3 CPU: (16) x64 Intel® Core™ i9-9880H CPU @ 2.30GHz Memory: 113.79 MB / 16.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 12.14.1 - /usr/local/bin/node Yarn: 1.16.0 - /usr/local/bin/yarn npm: 6.13.4 - /usr/local/bin/npm SDKs: iOS SDK: Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1 IDEs: Android Studio: 3.4 AI-183.6156.11.34.5522156 Xcode: 11.3/11C29 - /usr/bin/xcodebuild npmPackages: react: 16.9.0 => 16.9.0 react-native: 0.61.5 => 0.61.5

Steps To Reproduce

  1. Using the app while debugging mode ON
  2. Using the app while debugging mode OFF

Expected Results

  1. Api response takes 2 seconds
  2. Api response takes 11 seconds

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:9
  • Comments:35

github_iconTop GitHub Comments

5reactions
victoriaShcommented, Jan 10, 2021

@victoriaSh The ipv6 solution worked for you?

Yep! After setting up ipv6 for the domain that I’m using in fetch requests everything works fine. Still don’t get what exactly causes this behaviour. Guess there was a combination of 2 factors - my internet provider network settings + wrong IPv6 DNS settings for my domain. Try to make requests through mobile network or another internet provider. If it works fast that’s ipv6 settings problem.

3reactions
victoriaShcommented, Dec 2, 2020

Found a solution for my issue. Maybe it would be helpful for someone. Check IPv6 accessibility for the domain you trying to fetch from. https://ipv6-test.com/validate.php If web server is unreachable check your AAAA records, web server settings or ip6tables settings.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What could be causing this slow fetch in react native?
It is a known bug that parsing responses can lag badly when remote debugging is enabled. Disabling remote debugging should speed this up...
Read more >
Debugging slow REST requests - Ably FAQs
If you are seeing slow REST requests, there are a few different possible reasons why. 1. Routing.
Read more >
How to Deal With Slow APIs - CloudBoost
Simply terminate the APIs you no longer care about a response for and move on. You can easily do that by keep track...
Read more >
Troubleshooting a Slow Response - Xano Documentation
Debugging Performance Issues ... 502 errors when calling APIs or otherwise experiencing slow performance typically means that you are maxing out ...
Read more >
Suspense for Data Fetching (Experimental) - React
In this example, two components wait for an asynchronous API call to fetch some data: const resource = fetchProfileData(); function ProfilePage() { return...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found