This is a Twilio Labs project
This means this project is 100% open-source. You can find its source code in the Twilio Labs GitHub organization.
We currently don't support the projects through our official support channels. But you are welcome to reach out to us on GitHub for any questions, issues or suggestions or to contribute to this project.
There are two ways you can use the toolkit. If you are already using the Twilio CLI, you can install it via a plugin. Alternatively, you can use the toolkit as a standalone using twilio-run via npm or another Node.js package manager.
Throughout the docs we'll reference the Twilio CLI commands.
The Serverless Toolkit will perform a collection of API requests on your behalf and in order to speed things up might do so in parallel. Depending on your account it might get into the situation where you hit issues deploying due to concurrency issues.
To solve this issue, you can set the environment variable
TWILIO_SERVERLESS_API_CONCURRENCY to a value such as 1 to avoid any requests being performed in parallel.
By default this will create a new environment for you with the following properties:
- Domain Suffix: dev
- Unique Name: dev-environment
You can change the environment it deploys to by passing the domain suffix of the environment into the deploy command using the
--environment flag. If an environment with that domain suffix already exists, it will deploy to that one, otherwise it will create a new one.
If you don't pass any other options in, the Functions and Assets that are being deployed will be chosen based on your project structure. If you use a non-default folder name for the deployment of Assets or Functions, you can pass in the
--functions-folder flags to change them. Alternatively you can use the
--no-functions flags to turn these features of completely.
Additionally any variables except
AUTH_TOKEN will be uploaded as part of your deployment. To change the variables that are being uploaded use the
--env flag to point against another .env file.
There's a lot more configuration you can do for your deployment. The best way you can find out about the various options is using the
--help flag. It will list all options you have available.
Aside of deploying code to an environment by uploading everything again, you can take an existing deployment and activate it on another environment using the promote command. For example to move the same build from the dev environment to an environment with the domain suffix staging you can use the activate command.
Now that you learned how you can deploy your Twilio Functions, why not learn more, like how you can locally develop and debug your Functions.