Menu

Expand
Rate this page:

Runtime Handler

The Runtime Handler is a necessary dependency for any Twilio Function to be able to execute. It bootstraps the environment for your Function, manages the initialization of the Twilio Client, injects the Runtime Client into scope for your convenience, and other critical functions.

Versions

We follow the principle of Semantic Versioning to the best of our ability. We will only introduce breaking changes in major releases, new functionality in minor releases, and backwards compatible bug fixes in patch releases.

Release Version Description
1.2.0 Adds support for accessing and modifying incoming headers and cookies from the new event.request object
1.1.3 Bug fixes and minor improvements
1.1.2 Accessing SERVICE_SID or ENVIRONMENT_SID environment variables in local development will now cause a warning to be displayed
1.1.1 Bug fixes and minor improvements
1.1.0 The Twilio library is now lazy-loaded to improve the cold start time of Functions
1.0.2 Provides fixes for bugs in the local development environment
1.0.1 The default, initial release of the Runtime Handler

Preview Versions

The following versions are available as a preview of upcoming versions. They are not meant for production and might contain breaking changes between releases.

Previews are not covered by Twilio support agreements, and will not be supported via chat or paid phone support until after production launch. Customer help requests for some previews may be handled by Twilio engineers to improve those products for general availability release. Because these help requests are handled by our engineering team, responses may take longer.

For questions and feedback join Twilio Insiders.

There are currently no preview versions available.

Managing Versions

It is important to set the correct version of the Runtime Handler, especially if you want to take advantage of the latest features. The process of setting the version varies depending on whether you're developing using the Console, or programmatically such as with the Serverless Toolkit. Both methods are described below.

The version of Runtime Handler must be exact, such as 1.1.0. Version ranges are not supported.

For example, attempting to use latest or ^1.0.1 will fail when attempting to deploy

Via the Console

If your Function has been created and is managed entirely through the Console, you can set the version of @twilio/runtime-handler via the UI. To begin, navigate to the Function Editor for the Service that you want to update. Then complete the following steps:

  1. Under Settings, click on Dependencies. This will open a new tab in the editor, which contains a list of your Node version as well as all npm modules and their versions
  2. Click the Edit button for @twilio/runtime-handler, enter your desired version, and click Update
  3. When ready, click the Deploy All button to deploy your Service with the updated Runtime Handler in place

Set Runtime Handler version in dependencies.png

Via the Serverless Toolkit

If your Function was created and is maintained using the Serverless Toolkit, the process of updating the Runtime Handler can be done locally using your CLI.

Important: This requires at least version 2.1.0 of @twilio-labs/plugin-serverless or 3.1.0 of twilio-run.

  1. Open your project directory in your terminal, and run the following command wit your intended version.
    npm install @twilio/runtime-handler@<version> --save-exact
    • For example: npm install @twilio/runtime-handler@1.1.0 --save-exact
  2. Once ready to deploy your changes, run twilio serverless:deploy to deploy your Service with the new Runtime Handler version in effect
Rate this page:

Need some help?

We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Community Forums or browsing the Twilio tag on Stack Overflow.

        
        
        

        Thank you for your feedback!

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

        Sending your feedback...
        🎉 Thank you for your feedback!
        Something went wrong. Please try again.

        Thanks for your feedback!

        Refer us and get $10 in 3 simple steps!

        Step 1

        Get link

        Get a free personal referral link here

        Step 2

        Give $10

        Your user signs up and upgrade using link

        Step 3

        Get $10

        1,250 free SMSes
        OR 1,000 free voice mins
        OR 12,000 chats
        OR more