SUPPORT.TWILIO.COM END OF LIFE NOTICE: This site, support.twilio.com, is scheduled to go End of Life on February 27, 2024. All Twilio Support content has been migrated to help.twilio.com, where you can continue to find helpful Support articles, API docs, and Twilio blog content, and escalate your issues to our Support team. We encourage you to update your bookmarks and begin using the new site today for all your Twilio Support needs.

How to Promote a Previous Serverless Build Using the Twilio CLI and the Serverless Toolkit

Objective

When working with Twilio Functions and Assets, you may encounter situations where you need to revert your deployment to a previous build. This is especially useful if a recent deployment introduced issues or if you need to restore a known good state. The Twilio CLI, together with the Serverless Toolkit plugin, provides a straightforward way to promote a previous build to be the active deployment for your environment.

Product

Twilio Functions

Procedure 

Prerequisites

Important Notes

  • Builds will be deleted 7 days after not being associated to an active deployment
  • Promoting a previous build will restore all functions and assets to the state they were in at the time of that build.

Step-by-Step Process

Get your Service SID

twilio serverless:list services

Get your Environment SID

twilio serverless:list environments \
--service-sid ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Get your Build SID

twilio api:serverless:v1:services:builds:list \
--service-sid ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX \
--limit 20

Promote an Old Build

twilio serverless:promote \
--service-sid ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX \
--environment-sid ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX \
--build-sid ZBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Verify active build for the environment

twilio serverless:list environments \
--service-sid ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Troubleshooting & Best Practices

  • To verify you are promoting the correct build by review the build’s creation date and contents.
twilio api:serverless:v1:services:builds:fetch \
 --service-sid ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX \
 --sid ZBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX \
  • Keep your CLI and plugins up to date to avoid compatibility issues.

Additional References

Twilio serverless toolkit reference and command list

Serverless limits and retention policy

Have more questions? Submit a request
Powered by Zendesk