Level up your Twilio API skills in TwilioQuest, an educational game for Mac, Windows, and Linux. Download Now


Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

Functions FAQ


This Twilio product is currently available as a beta release. Some features are not yet implemented and others may be changed before the product is declared as Generally Available. Beta products are not covered by a Twilio SLA.

See this article for more information on beta product support.


There are two possible reasons for why your Function has completed with the error: 'runtime application timed out'.

The most common reason is that your Function has exceeded the 10-second execution time limit. You can determine this by looking at the execution logs on the Function instance page. The last log line after execution will tell you how many milliseconds the Function took to execute. If the processing time is greater than 10,000 milliseconds then your Function was terminated by Twilio.


The other more subtle reason your Function ended with an application timeout is because of an incorrect invocation of callback(). If the callback() method is not being called or is unreachable, your Function will continue executing until it reaches the time limit and ultimately fails. A very common mistake is to forget to capture the catch() rejected state of a Promise and calling callback() there as well. The Function Execution documentation provides extensive details on the functionality and usage of the callback() method. Below are several examples of how to correctly use callback() to complete execution and emit a response.





        The most common reason we have seen that a Function appears not to run is the misuse of callback(). Your Function invocation terminates as soon as the callback() is reached. If your request is asynchronous, for example, an API call to a Twilio resource, then the callback() must be placed inside the success response of the request.

              空のHTTP 200 OKの返し方の例


              空のHTTP 200 OKの返し方の例

              Voice TwiMLの組み立て方は?

              Function内臓のTwilio Nodeライブラリーを使用してVoice TwiMLを生成できます。

                    Voice TwiMLレスポンスの組み立て方の例

                    Voice TwiMLを組み立てる

                    Voice TwiMLレスポンスの組み立て方の例

                    Messaging TwiMLの返し方は?

                    Function内臓のTwilio Nodeライブラリーを使用して、MessagingTwiMLを生成できます。

                          Messaging TwiMLの組み立て方法の例

                          Messaging TwiMLを組み立てる

                          Messaging TwiMLの組み立て方法の例


                          Function 実行ドキュメントで触れられているように、オブジェクトを返すだけで行えます。

                                HTTP 200 OKでJSONを返す方法の例


                                HTTP 200 OKでJSONを返す方法の例


                                You can send CORS headers by using the Twilio Response object described in the Function Execution documentation.

                                      Twilio Responseに複数のヘッダーを設定する例


                                      Twilio Responseに複数のヘッダーを設定する例


                                      Currently, Functions are event-driven and can only be invoked by HTTP.


                                      Absolutely! In addition to our Programmable SMS and Programmable Voice quickstarts, you can find a variety of templates within our catalog within the Create Function page.

                                      How many Functions can I create?

                                      During the beta period, we currently have a limit of 100 functions per account. To create more Functions, consider using the Functions and Assets API.

                                      Can I create temporary files when executing a Function?

                                      Yes. See this blog post for a description and samples on how to store files for one off usage.

                                      Rate this page:


                                      誰しもが一度は考える「コーディングって難しい」。そんな時は、お問い合わせフォームから質問してください。 または、Stack Overflow でTwilioタグのついた情報から欲しいものを探してみましょう。