I’m having trouble when calling an API endpoint that’s hosted in another server. For a reason I still didn’t figured out, when calling endpoints in api.rheconsultora.com from the server (i.e. no Client Side Rendering) I sometimes (more often than not) get a timeout error stating that the endpoint delayed more than 10s to respond.
The endpoint I can guarantee works properly and is completly open access (no credentials nor cookies required). I’ve already talked with my hosting provider on which the API is hosted, and they told me to inquiry Vercel to know the IP addresses that are being used to call the endpoint. Because, as far as I know, Vercel uses dynamic addresses and that may (this is not for sure) be being blocked by the firewall on the cPanel.
I don’t discard that the issue may be related to my code, so I have no issue in sharing it. That said, on localhost the project works properly and nothing times out.
For now I’ve patched the solution by limiting the request to 3s, but this isn’t optimal as it greatly harms my Google crawl SEO on my structured data.
Hi @rheconsultora-1047, welcome to the Vercel Community!
If I understand correctly, you’ve an external api api.rhecons.... and you make HTTP requests to this from your Next.js App hosted on Vercel? These requests timeout?
Can you share the code where you make the API call? Also, logs from Vercel dashboard?
Can I access the API as well to confirm if the endpoint is working as expected?
I’ve run into a similar situation. Inside the API router, when I use fetch to call other endpoints, the request times out after 10 seconds, even though I’ve set the router’s maxDuration to 60.
Hi @zainchen, in this screenshot we can see the Vercel function didn’t timeout 10.49s / 1m (60s), which is what you set in the maxDuration. If this is an external API it can be possible that the API has set a 10 seconds timeout limit for this operation. Can you check with the API provider about this?
Hi, glad for your help. When I fetch this API directly in the browser, without going through the API router, the request succeeds after 22 seconds. So it’s probably not an issue with the API provider.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

