I read that netlify uses a limit of 10seconds per lambda function. I use an API call in my serverless function, which can take a few seconds to generate the data on the API backend.
- Do API calls (await) also count as function time, or is it just actual run time that’s counted ?
- How to handle lamdba timeouts ?
Waiting time counts as well. After 10 seconds, the function returns a timeout error itself.
When you’re on some paid plan, you can get your timeout increased to some 26 seconds I guess. That’s the max Netlify can go as this limit is imposed on them as far as I know.
If you need even more time, you’ll have to work with Background Functions which have a limit of 15 mins.
Thanks for replying to 1. Interesting about the 26 seconds, seems like an odd number.
Re: 2. Do you have a link to a documentation of the proper return error ?
No, I don’t have the exact error message per se, but it’s something along the lines:
Task timeout after 10 seconds. See here: Netlify Function Timeout after 10 seconds when published