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:
_10 '[{"name": "randomcolor","version":"0.5.4" },
_10 {"name": "util","version":"0.10.3" },
_10 {"name": "xmldom","version":"0.1.27" },
_10 {"name": "got","version":"6.7.1" },
_10 {"name": "fs","version":"0.0.1-security" },
_10 {"name": "lodash","version":"4.17.11" },
_10 {"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.
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.
Resource properties The unique string that we created to identify the Build resource.
The SID of the Service that the Build resource is associated with.
The status of the Build. Can be: building
, completed
, or failed
.
Possible values:
building
completed
failed
The list of Asset Version resource SIDs that are included in the Build.
function_versions
type: array Not PIIThe list of Function Version resource SIDs that are included in the Build.
A list of objects that describe the Dependencies included in the Build. Each object contains the name
and version
of the dependency.
The Runtime version that will be used to run the Build resource when it is deployed.
Possible values:
node8
node10
node12
node14
node16
node18
date_created
type: string<DATE TIME> Not PIIdate_updated
type: string<DATE TIME> Not PIIThe absolute URL of the Build resource.
POST https://serverless.twilio.com/v1/Services/{ServiceSid}/Builds
URI parameters Path Parameter
The SID of the Service to create the Build resource under.
Request body parameters The list of Asset Version resource SIDs to include in the Build.
FunctionVersions
type: string[] Not PIIThe list of the Function Version resource SIDs to include in the Build.
A list of objects that describe the Dependencies included in the Build. Each object contains the name
and version
of the dependency.
The Runtime version that will be used to run the Build resource when it is deployed.
Info 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.
Warning 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
_14 // Download the helper library from https://www.twilio.com/docs/node/install
_14 // Find your Account SID and Auth Token at twilio.com/console
_14 // and set the environment variables. See http://twil.io/secure
_14 const accountSid = process.env.TWILIO_ACCOUNT_SID;
_14 const authToken = process.env.TWILIO_AUTH_TOKEN;
_14 const client = require('twilio')(accountSid, authToken);
_14 client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_14 functionVersions: ['ZNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'],
_14 assetVersions: ['ZNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX']
_14 .then(build => console.log(build.sid));
_45 "sid": "ZB00000000000000000000000000000000",
_45 "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_45 "service_sid": "ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_45 "sid": "ZN00000000000000000000000000000000",
_45 "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_45 "service_sid": "ZS00000000000000000000000000000000",
_45 "asset_sid": "ZH00000000000000000000000000000000",
_45 "date_created": "2018-11-10T20:00:00Z",
_45 "path": "/asset-path",
_45 "visibility": "PUBLIC"
_45 "function_versions": [
_45 "sid": "ZN00000000000000000000000000000001",
_45 "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_45 "service_sid": "ZS00000000000000000000000000000000",
_45 "function_sid": "ZH00000000000000000000000000000001",
_45 "date_created": "2018-11-10T20:00:00Z",
_45 "path": "/function-path",
_45 "visibility": "PUBLIC"
_45 "name": "@twilio/runtime-handler",
_45 "status": "building",
_45 "date_created": "2018-11-10T20:00:00Z",
_45 "date_updated": "2018-11-10T20:00:00Z",
_45 "url": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Builds/ZB00000000000000000000000000000000",
_45 "build_status": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Builds/ZB00000000000000000000000000000000/Status"
_14 // Download the helper library from https://www.twilio.com/docs/node/install
_14 // Find your Account SID and Auth Token at twilio.com/console
_14 // and set the environment variables. See http://twil.io/secure
_14 const accountSid = process.env.TWILIO_ACCOUNT_SID;
_14 const authToken = process.env.TWILIO_AUTH_TOKEN;
_14 const client = require('twilio')(accountSid, authToken);
_14 client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_14 functionVersions: ['ZNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'],
_14 dependencies: `[{"name":"twilio","version":"3.71.2"},{"name":"@twilio/runtime-handler","version":"1.2.1"}]`
_14 .then(build => console.log(build.dependencies));
_45 "sid": "ZB00000000000000000000000000000000",
_45 "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_45 "service_sid": "ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_45 "sid": "ZN00000000000000000000000000000000",
_45 "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_45 "service_sid": "ZS00000000000000000000000000000000",
_45 "asset_sid": "ZH00000000000000000000000000000000",
_45 "date_created": "2018-11-10T20:00:00Z",
_45 "path": "/asset-path",
_45 "visibility": "PUBLIC"
_45 "function_versions": [
_45 "sid": "ZN00000000000000000000000000000001",
_45 "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_45 "service_sid": "ZS00000000000000000000000000000000",
_45 "function_sid": "ZH00000000000000000000000000000001",
_45 "date_created": "2018-11-10T20:00:00Z",
_45 "path": "/function-path",
_45 "visibility": "PUBLIC"
_45 "name": "@twilio/runtime-handler",
_45 "status": "building",
_45 "date_created": "2018-11-10T20:00:00Z",
_45 "date_updated": "2018-11-10T20:00:00Z",
_45 "url": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Builds/ZB00000000000000000000000000000000",
_45 "build_status": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Builds/ZB00000000000000000000000000000000/Status"
Primarily used when upgrading to a new version of Node.js. Only needs to be run once, and will apply to subsequent deploys
_14 // Download the helper library from https://www.twilio.com/docs/node/install
_14 // Find your Account SID and Auth Token at twilio.com/console
_14 // and set the environment variables. See http://twil.io/secure
_14 const accountSid = process.env.TWILIO_ACCOUNT_SID;
_14 const authToken = process.env.TWILIO_AUTH_TOKEN;
_14 const client = require('twilio')(accountSid, authToken);
_14 client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_14 functionVersions: ['ZNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'],
_14 .then(build => console.log(build.sid));
_45 "sid": "ZB00000000000000000000000000000000",
_45 "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_45 "service_sid": "ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_45 "sid": "ZN00000000000000000000000000000000",
_45 "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_45 "service_sid": "ZS00000000000000000000000000000000",
_45 "asset_sid": "ZH00000000000000000000000000000000",
_45 "date_created": "2018-11-10T20:00:00Z",
_45 "path": "/asset-path",
_45 "visibility": "PUBLIC"
_45 "function_versions": [
_45 "sid": "ZN00000000000000000000000000000001",
_45 "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_45 "service_sid": "ZS00000000000000000000000000000000",
_45 "function_sid": "ZH00000000000000000000000000000001",
_45 "date_created": "2018-11-10T20:00:00Z",
_45 "path": "/function-path",
_45 "visibility": "PUBLIC"
_45 "name": "@twilio/runtime-handler",
_45 "status": "building",
_45 "date_created": "2018-11-10T20:00:00Z",
_45 "date_updated": "2018-11-10T20:00:00Z",
_45 "url": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Builds/ZB00000000000000000000000000000000",
_45 "build_status": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Builds/ZB00000000000000000000000000000000/Status"
GET https://serverless.twilio.com/v1/Services/{ServiceSid}/Builds/{Sid}
URI parameters Path Parameter
The SID of the Service to fetch the Build resource from.
Path Parameter
The SID of the Build resource to fetch.
_11 // Download the helper library from https://www.twilio.com/docs/node/install
_11 // Find your Account SID and Auth Token at twilio.com/console
_11 // and set the environment variables. See http://twil.io/secure
_11 const accountSid = process.env.TWILIO_ACCOUNT_SID;
_11 const authToken = process.env.TWILIO_AUTH_TOKEN;
_11 const client = require('twilio')(accountSid, authToken);
_11 client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11 .builds('ZBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11 .then(build => console.log(build.sid));
_45 "sid": "ZBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_45 "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_45 "service_sid": "ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_45 "sid": "ZN00000000000000000000000000000000",
_45 "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_45 "service_sid": "ZS00000000000000000000000000000000",
_45 "asset_sid": "ZH00000000000000000000000000000000",
_45 "date_created": "2018-11-10T20:00:00Z",
_45 "path": "/asset-path",
_45 "visibility": "PUBLIC"
_45 "function_versions": [
_45 "sid": "ZN00000000000000000000000000000001",
_45 "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_45 "service_sid": "ZS00000000000000000000000000000000",
_45 "function_sid": "ZH00000000000000000000000000000001",
_45 "date_created": "2018-11-10T20:00:00Z",
_45 "path": "/function-path",
_45 "visibility": "PUBLIC"
_45 "name": "@twilio/runtime-handler",
_45 "status": "building",
_45 "date_created": "2018-11-10T20:00:00Z",
_45 "date_updated": "2018-11-10T20:00:00Z",
_45 "url": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Builds/ZB00000000000000000000000000000000",
_45 "build_status": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Builds/ZB00000000000000000000000000000000/Status"
GET https://serverless.twilio.com/v1/Services/{ServiceSid}/Builds
URI parameters Path Parameter
The SID of the Service to read the Build resources from.
Query Parameter
How many resources to return in each list page. The default is 50, and the maximum is 1000.
Query Parameter
The page index. This value is simply for client state.
Query Parameter
The page token. This is provided by the API.
_11 // Download the helper library from https://www.twilio.com/docs/node/install
_11 // Find your Account SID and Auth Token at twilio.com/console
_11 // and set the environment variables. See http://twil.io/secure
_11 const accountSid = process.env.TWILIO_ACCOUNT_SID;
_11 const authToken = process.env.TWILIO_AUTH_TOKEN;
_11 const client = require('twilio')(accountSid, authToken);
_11 client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11 .then(builds => builds.forEach(b => console.log(b.sid)));
_12 "first_page_url": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Builds?PageSize=50&Page=0",
_12 "next_page_url": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Builds?PageSize=50&Page=1",
_12 "previous_page_url": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Builds?PageSize=50&Page=0",
_12 "url": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Builds?PageSize=50&Page=0"
DELETE https://serverless.twilio.com/v1/Services/{ServiceSid}/Builds/{Sid}
URI parameters Path Parameter
The SID of the Service to delete the Build resource from.
Path Parameter
The SID of the Build resource to delete.
_10 // Download the helper library from https://www.twilio.com/docs/node/install
_10 // Find your Account SID and Auth Token at twilio.com/console
_10 // and set the environment variables. See http://twil.io/secure
_10 const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10 const authToken = process.env.TWILIO_AUTH_TOKEN;
_10 const client = require('twilio')(accountSid, authToken);
_10 client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_10 .builds('ZBXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')