Menu

Expand
Rate this page:

Build

Builds are packages of Functions and Assets that you bundle together for deployment. Builds contain Function Version SIDs, Asset Version SIDs, and Dependencies.

Dependencies are defined as JSON strings, for example:

'[{"name": "randomcolor","version":"0.5.4" },
 {"name": "util","version":"0.10.3" },
 {"name": "xmldom","version":"0.1.27" },
 {"name": "got","version":"6.7.1" },
 {"name": "fs","version":"0.0.1-security" },
 {"name": "lodash","version":"4.17.11" },
 {"name": "date-fns","version":"1.30.1" }]'

Builds take time to package, deploy, and be verified. After creating a Build, it is best to poll every second to check the Build's status. When a Build is verified, it is ready to be used in a Deployment.

List of Build statuses

Build status

Meaning

Building Build request is being processed by the packager.
Completed We have run a health check on the uploaded package and verified it.
Failed Packaging has failed at any of the above steps.

Build properties

Resource Properties in REST API format
sid
sid<ZB> Not PII

The unique string that we created to identify the Build resource.

account_sid
sid<AC> Not PII

The SID of the Account that created the Build resource.

service_sid
sid<ZS> Not PII

The SID of the Service that the Build resource is associated with.

status
enum:status Not PII

The status of the Build. Can be: building, completed, or failed.

asset_versions
object[] Not PII

The list of Asset Version resource SIDs that are included in the Build.

function_versions
object[] Not PII

The list of Function Version resource SIDs that are included in the Build.

dependencies
object[] Not PII

A list of objects that describe the Dependencies included in the Build. Each object contains the name and version of the dependency.

runtime
enum:runtime Not PII

The Runtime version that will be used to run the Build resource when it is deployed.

date_created
date_time<iso8601> Not PII

The date and time in GMT when the Build resource was created specified in ISO 8601 format.

date_updated
date_time<iso8601> Not PII

The date and time in GMT when the Build resource was last updated specified in ISO 8601 format.

url
url Not PII

The absolute URL of the Build resource.

links
uri_map Not PII

Create a Build resource

post
https://serverless.twilio.com/v1/Services/{ServiceSid}/Builds
Parameters
Parameters in REST API format
service_sid
Path
post sid_like<ZS> Not PII

The SID of the Service to create the Build resource under.

asset_versions
Optional
post sid<ZN>[] Not PII

The list of Asset Version resource SIDs to include in the Build.

function_versions
Optional
post sid<ZN>[] Not PII

The list of the Function Version resource SIDs to include in the Build.

dependencies
Optional
post string Not PII

A list of objects that describe the Dependencies included in the Build. Each object contains the name and version of the dependency.

runtime
Optional
post string Not PII

The Runtime version that will be used to run the Build resource when it is deployed.

You must specify all Function or Asset Versions when creating a Build. Builds only use the provided Versions, and do not reference the Versions used by previous Builds.

In order to create a Build successfully, your request must include at least one Function Version, Asset Version, or a combination of both.

If no Function or Asset Versions are indicated, you'll receive Error 20001:

At least one Function Version or Asset Version is required for Build

Example 1
Loading Code Sample...
        
        

        Create a Build

        Example 2
        Loading Code Sample...
              
              

              Create a Build and specify Dependencies

              Example 3
              Loading Code Sample...
                    
                    
                    Primarily used when upgrading to a new version of Node.js. Only needs to be run once, and will apply to subsequent deploys

                    Create a build with a specific Node.js runtime

                    Primarily used when upgrading to a new version of Node.js. Only needs to be run once, and will apply to subsequent deploys

                    Fetch a Build resource

                    get
                    https://serverless.twilio.com/v1/Services/{ServiceSid}/Builds/{Sid}
                    Parameters
                    Parameters in REST API format
                    service_sid
                    Path
                    get sid_like<ZS> Not PII

                    The SID of the Service to fetch the Build resource from.

                    sid
                    Path
                    get sid<ZB> Not PII

                    The SID of the Build resource to fetch.

                    Example 1
                    Loading Code Sample...
                          
                          

                          Fetch Build

                          Read multiple Build resources

                          get
                          https://serverless.twilio.com/v1/Services/{ServiceSid}/Builds
                          Parameters
                          Parameters in REST API format
                          service_sid
                          Path
                          get sid_like<ZS> Not PII

                          The SID of the Service to read the Build resources from.

                          Example 1
                          Loading Code Sample...
                                
                                

                                Read Build

                                Delete a Build resource

                                delete
                                https://serverless.twilio.com/v1/Services/{ServiceSid}/Builds/{Sid}
                                Parameters
                                Parameters in REST API format
                                service_sid
                                Path
                                delete sid_like<ZS> Not PII

                                The SID of the Service to delete the Build resource from.

                                sid
                                Path
                                delete sid<ZB> Not PII

                                The SID of the Build resource to delete.

                                Example 1
                                Loading Code Sample...
                                      
                                      

                                      Delete Build

                                      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 Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.

                                      Loading Code Sample...
                                            
                                            
                                            

                                            Thank you for your feedback!

                                            Please select the reason(s) for your feedback. The additional information you provide helps us improve our documentation:

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

                                            Thanks for your feedback!

                                            thanks-feedback-gif