I am creating an astro page as an endpoint that would get some data from Zoho Creator. There’s plenty of products to get and it would take more than 10 seconds for the function to run… and I am encountering this error
TimeoutError: Task timed out after 10.00 seconds
new TimeoutError (/home/alimbolar/.nvm/versions/node/v18.13.0/lib/node_modules/netlify-cli/node_modules/lambda-local/build/lib/utils.js:116:28)
Context.<anonymous> (/home/alimbolar/.nvm/versions/node/v18.13.0/lib/node_modules/netlify-cli/node_modules/lambda-local/build/lib/context.js:110:19)
listOnTimeout (node:internal/timers:564:17)
processTimers (node:internal/timers:507:7)
I have not yet uploaded the site to netlify but I am using the netlify cli and I am assuming that I’d encounter the same error if I were to run it from netlify.
Please advise what should I do to be able to run this function which takes more than 10 seconds. Is it not possible on netlify? Or is there some workaround for such functions?
thanks for the update… so I realise that I can’t use netlify as an adapter for my astro SSR project because of the timeout issue.
Could you advise me on what are my options? I would like to use astro and I know this is not an astro support site…;-)… but would you be able to advise me on the best option? I could not get much information on using node as an adapter and it was all very confusing… so come help would be appreciated… but if it’s beyond the scope of netlify support, don’t worry I understand…:-)…
Hi @alimbolar aside from using a different platform you could try the following:
Use a different build process: Astro is built on top of Snowpack, which is a fast build tool that works well for static sites. However, if you have a larger SSR project, you might need a different build process. For example, you could try Next.js or Gatsby?
But even if I use Next.js or something else, the limitation of the 10 seconds for the function to run would still exist… right?
The reason for this reconfirmation is that I wanted to be clear that if I had to create an application which would in any case take a long time to run a script, it wouldn’t be a good idea to try to use netlify as my option for that.
@alimbolar Several frameworks in Next.js, SvelteKit, Astro, have SSR functionality that works on Netlify. So it is certainly possible.
If an SSR script is taking more than 10 seconds (even more than a couple of seconds) to execute, it is unlike many people would stick around and wait for the page to load—I know I wouldn’t wait 10 seconds for a page to load.
Yes i do understand that for a frontend application it would be unrealistic to have a 10 second waiting time… but I was trying to use astro for creating an endpoint for a backend script… this particular function i wanted to run locally and maybe would not even use on production…
However i am not aware how set up astro using node as an adapter and the documentation on doing this confused me a lot… especially after being used to how ‘netlify’ just works!..;-)…
If there’s some link you could share that explains to someone ‘like he is a 5 year old’ how to use node as an adapter with astro i would really appreciate it… that way i could run this particular script locally…
These forums aren’t the place to “explain it like 5 year old” as you put it. The @astro/netlify adapter documentation provides example configuration/code and even provides a link to search GitHub for examples.
If you are still having issues getting Astro worked out, the Astro discord channel is probably the best place to get assistance from people who are deeply familiar with the framework. Check out the link on the Astro homepage.