Menu

Expand
Rate this page:

Dependencies

Runtime features an integrated package manager that handles the retrieval, installation, and deployment of third-party packages to support your Functions. This enables developers to access an incredible collection of packages provided by the Node.js community via NPM.

You can see your Dependencies on the Dependencies tab in the Functions Editor, and in Build status responses via API.

settings_9uPk4tx.gif

Default Dependencies

You should always see Twilio and @twilio/runtime-handler in the Dependencies pane if you are using the UI, and Build details using API.

The default version of the Twilio SDK dependency and Runtime handler is included on all Builds. These Dependencies are visible on all existing Builds via the API and in the Functions UI Editor.

This does not apply to Functions(Classic).

Screenshot 2021-01-28 at 6.54.18 AM.png

handler dependency terminal.png

You can determine the latest version of the Twilio Node helper library, or set the latest Dependencies for your Twilio functions with a * or latest. Keeping Twilio helper libraries up to date enables you to take advantage of the latest Twilio product functionality.

Getting Started

Developers can add, remove and update Dependencies through the Console. Dependencies can be found on the Dependencies tab in the Functions Editor under Settings. This list includes all of the NPM modules currently installed for the deployed Function.

Adding a new Dependency

  1. Enter the name and version of the NPM module you want to include in the first row with empty fields.
  2. Click Add. This will prepare your next deployment to install and bundle the NPM module with your Functions.

Removing a Dependency

  1. Click Delete to remove any package you want to remove from Dependencies. On the next deployment of your Functions, the package will not be included.

Changing the version of a Dependency

  1. Find the NPM module you want to update in the Dependencies list and click Edit. Then enter the new version you want to use in the Version field.
  2. Click Update. This will update the version of the NPM module to the specified version on the next deployment of your Functions.

Limitations

  • Native Packages Not Supported - Functions does not provide a C/C++ compiler required to compile native add-on modules. This means modules that depend on node-gyp can not be installed to Functions.
  • 20 NPM Modules Limit - During the public beta, developers will be limited to installing 20 NPM modules. To raise these limits during the public beta, please contact Twilio Support.

Setting Dependencies for Functions(Classic)

Functions(Classic) is a prior version of Twilio Functions. This is completely independent of the current Functions and Assets API and works in conjunction with Assets(Classic).

Developers can add, remove and update Dependencies through the Console. Dependencies can be found in Functions Settings under the Dependencies header. This list includes all of the NPM modules currently installed in the Functions Environment.

Adding a new Dependency

  1. Click the + button at the top of the Packages list. This will add a new row to the Packages table.
  2. Enter the name and version of the NPM module you want to include in the new row.
  3. Click Save. This will install and deploy the NPM module to the Functions Environment.

Removing a Dependency

  1. Click the x on the NPM module that you want to remove from your Packages list.
  2. Click Save. The NPM module will be uninstalled, and the Functions Environment will be deployed to complete the removal.

Changing the version of a Dependency

  1. Find the NPM module you want to update in the Packages list. Then enter the new version you want to use in the Version field.
  2. Click Save. This will update the version of the NPM module and deploy the Functions Environment with the specified version.
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