Menu

Expand
Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

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 Node.js packages from NPM.

Dependencies are defined as JSON strings, for example:

let dependencies = `[{"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 1 second to check the build status. When a build is verified, it is ready to be used in a Deployment.

List of build statuses

Build Status

Meaning

Queued A build request has been queued to be picked and deployed.
Building Build request being processed by the packager.
Deploying New package is being uploaded.
Deployed Package successfully deployed.
Verified We have run a health check on the uploaded package and verified it.
Failed Packaging has failed at any of the above step.

Build properties

Names in PHP format
sid
sid<ZB> Not PII

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

accountSid
sid<AC> Not PII

The SID of the Account that created the Build resource.

serviceSid
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.

assetVersions
object[] Not PII

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

functionVersions
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.

dateCreated
date_time<iso8601> Not PII

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

dateUpdated
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.

Create a Build resource

post
https://serverless.twilio.com/v1/Services/{ServiceSid}/Builds
Parameters
Names in None format
service_sid
Required
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 Variable 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.

Example
        
        
        
        

        Fetch a Build resource

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

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

        sid
        Required
        get sid<ZB> Not PII

        The SID of the Build resource to fetch.

        Example
              
              
              
              

              Read multiple Build resources

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

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

              Example
                    
                    
                    
                    

                    Delete a Build resource

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

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

                    sid
                    Required
                    delete sid<ZB> Not PII

                    The SID of the Build resource to delete.

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