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.
The default version of the Twilio SDK and Runtime handler are a part of all Builds.
You will always see twilio
and @twilio/runtime-handler
in the Dependencies pane of the Twilio Console UI, package.json
if using the Serverless Toolkit, and in the Build response returned by the Serverless API.
@twilio/runtime-handler
is not utilized by Functions (Classic), and is not a default dependency in that context.
Only public packages, like those hosted by npm, can be managed by the methods below. If you require a private package, you should add it as a private Asset and access it from your Function's code instead.
Developers can add, remove and update Dependencies through the Console.
Click the Dependencies option under Settings to see your Dependencies in the Functions Editor.
This list includes all the npm modules currently installed for the deployed Function.
Enter the name and version of the npm module you want to include in the first row of empty fields.
Click Add. This will prepare your next Deployment to install and bundle the npm module with your Functions.
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.
Click Update. This will update the version of the npm module to the specified version on the next Deployment of your Functions.
Keeping Twilio helper libraries up to date enables you to take advantage of the latest Twilio product functionality.
You can determine the latest version of the Twilio Node helper library, or set the latest Dependencies for your Twilio functions by setting them to *
or latest
in the Twilio Console UI.
If using the Serverless Toolkit and package.json
, you could alternatively use a dependency version range such as "latest"
.
The version of @twilio/runtime-handler
must be defined as an explicit value, such as 1.2.1
. Using version ranges, such as *
and latest
, will result in a Build failure.
Native packages are not supported — Runtime does not provide a C/C++ compiler, which is required to compile native add-on modules. This means modules that depend on node-gyp
can not be used in your Functions.
npm modules limit — Services are limited in the number of npm modules that may be installed. This is dependent on which version of Runtime you are using: