fetch() calls throwing Connect Timeout Errors

We are fetching a lof images from our CMS during build. We are recently getting Connect Timeout Error a lot. First, it was one image. But now the more images are getting added to the CMS, the more we are getting Connect Timeout Error. Why is it happening? Is there any concurrent request limit in Cloudflare Pages? And if there's a limit, should Cloudflare automatically handle this?
8 Replies
zegevlier
zegevlier2y ago
AFAIK there is no built-in limit during the build process, but perhaps there is as an anti abuse method. The build environment is just a linux container. Have you tried running the build locally, does it happen then? There is a concurrent fetch request limit in workers / pages functions, but that has no impact on build.
Muhymin
MuhyminOP2y ago
It didn't use to happen locally But now I see it's happening locally too In Cloudflare, I'm getting 100+ errors but locally I'm getting 2 So, that's why it was not happening before locally when in Cloudflare only 1/2 errors were happening It's probably a bug in undici
zegevlier
zegevlier2y ago
Perhaps it's your CMS' anti bot / anti DDOS protection? The CF build containers are run on datacenter IPs, those are inherently trusted less than residential IPs
Muhymin
MuhyminOP2y ago
GitHub
fetch times out in under 5 seconds · Issue #1531 · nodejs/undici
Bug Description When trying to fetch a URL a fetch failed error is thrown with the code as code: 'UND_ERR_CONNECT_TIMEOUT' , This error is thrown at a request that barely takes 5 - 6 second...
Muhymin
MuhyminOP2y ago
Probably that's not the case yup! How did you do that?? By fetching them synchronously??
JohnDotAwesome
Very much sounds like your CMS is blocking you. What CMS are you using? Do they have CDN-links to your assets that aren't restricted?
Muhymin
MuhyminOP2y ago
Strapi There are actually two issues happening, the first one is the VPS that is hosting the Strapi CMS isn't being able to handle hundreds of requests simultaneously
Muhymin
MuhyminOP2y ago
And the second issue is https://github.com/nodejs/undici/issues/1531 which is related with Happy Eyeballs support in Node.js
GitHub
fetch times out in under 5 seconds · Issue #1531 · nodejs/undici
Bug Description When trying to fetch a URL a fetch failed error is thrown with the code as code: 'UND_ERR_CONNECT_TIMEOUT' , This error is thrown at a request that barely takes 5 - 6 second...
Want results from more Discord servers?
Add your server