Do HTTP requests (fetch calls) count toward the 2s CPU time limit in Edge Functions?

My function is hitting CPU time limits but mostly just makes external API calls (OpenAI, etc). The docs say CPU time "does not include async I/O" but I want to confirm: does waiting for fetch() responses count as CPU time or not?
3 Replies
garyaustin
garyaustin5d ago
It does not use CPU time but does count towards total time the edge function can run.
Heloi Neto
Heloi NetoOP5d ago
Ok, but that's 150s . I believe it's more than enough. Is this by default or do I have to call my HTTP requests a certain way? Also, is there any documentation on how this works exactly? I'm new to these edge concepts and would like to know more
garyaustin
garyaustin5d ago
Depends on how you are calling your http endpoints. If you use await then then it should not use CPU time. The edge docs cover timeouts and a bit on architecture. They are Deno functions so might be more info there. Add some logging to see where the time is going. What is your exact error message?

Did you find this page helpful?