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

Chrome fails (Uncaught (in promise) TypeError: Failed to fetch) #22

Closed
ssuess opened this issue Nov 5, 2020 · 1 comment
Closed

Chrome fails (Uncaught (in promise) TypeError: Failed to fetch) #22

ssuess opened this issue Nov 5, 2020 · 1 comment

Comments

@ssuess
Copy link

ssuess commented Nov 5, 2020

Chrome (not FF and not Safari, they are just fine) was failing when I send a large number (more than 1000 or so) api calls via a fetch array. I thought I could solve this by reducing concurrency using async-pool, but Chrome still fails with code like the following:

  const ps = jdone.cprefixes.map(p => fetch(`${baseUrl}${jdone.num}&prefix=${p.prefix}`))
  const timeout = i => new Promise(resolve => setTimeout(() => resolve(i), i))
  const reqs =  await asyncPool(2, ps, timeout).then(j => j.map(k => k.json()))
  console.log('reqs', reqs)

In Firefox and Safari, the above code executes without any issues no matter the size of the array, but in Chrome (87.0.xxx at the moment, but many versions) I get a series of failures (Uncaught (in promise) TypeError: Failed to fetch) when the number of fetch calls in the array is large (more than several hundred)

Any clue how I could make chrome work with this?

@ssuess
Copy link
Author

ssuess commented Nov 5, 2020

Well, chrome has some serious issues that could only be dealt with by introducing a slight delay between each and every individual fetch request, so I had to setTimeout to 5ms, then loop over everyone individually. UGH google.

@ssuess ssuess closed this as completed Nov 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant