SUPPORT.TWILIO.COM END OF LIFE NOTICE: This site, support.twilio.com, is scheduled to go End of Life on February 27, 2024. All Twilio Support content has been migrated to help.twilio.com, where you can continue to find helpful Support articles, API docs, and Twilio blog content, and escalate your issues to our Support team. We encourage you to update your bookmarks and begin using the new site today for all your Twilio Support needs.

Can I Increase the Execution Timeout for Twilio Functions?

Question

Can the execution timeout limit for Twilio Functions be raised beyond 10 seconds (the current limit)?

 

Product

Twilio Functions/Serverless

 

Environment

Twilio Console, legacy Twilio Console

 

Answer

No, the maximum execution timeout for a Twilio Function is 10 seconds, and is a hard, non-configurable platform limit. Due to this restriction, the limit cannot be increased for individual functions or accounts.

If your function takes longer than 10 seconds to complete its execution, the runtime will time out automatically and return an 'application runtime timed out' error.

 

To prevent timeout errors, consider implementing the following strategy within your application:

  • Invoke the Callback Promptly: Ensure your code always triggers the callback() method as soon as processing is complete. Forgetting to invoke the callback will force the Function to continue running until it hits the hard 10-second limit.

  • Optimize function execution: Reduce latency by optimizing external queries, external API requests, and synchronous operations.

  • Implement asynchronous processing: Offload heavy computations or long-running tasks to external queue systems or worker services rather than processing them synchronously within the function.

  • Modularize architecture: Break complex logic down into smaller, lightweight functions that execute quickly.

 

Additional Information 

Have more questions? Submit a request
Powered by Zendesk