In order to run your background function on its infrastructure, the Defer Platform needs to know about your node background functions. That is the role of the Builder.

Specifically, the Builder is responsible for the following:

  • verification of your project compatibility (including defer background functions lookup)
  • bundling of your background functions
  • extraction of your background functions metadata (configuration of retries, concurrency, CRON)
  • storing your background function bundles for later Runner use

A Builder invocation is called a build, and performs all those tasks on your project.

Each build is processed sequentially. This page covers the lifecycle of a build.

State definitions

  • Created: the build is enqueued and will soon start
  • Started: the build has been picked up by the Builder worker
  • Cloning: your project is being cloned
  • Installing: your NPM dependencies are installing
  • Generating: your pre-build command is executing
  • Compiling: the Builder is compiling and bundling your background functions
  • Publishing: you background functions bundles and build logs are being stored
  • Succeed: the build is finished without any error
  • Failed: the build has failed with errors

State machine diagram

builder state machine diagram

Events and transitions

New environmentcreatedNew environment created from the console
Environment updatecreatedEnvironment updated from the console
Rebuildsucceed, failedcreatedRebuild triggered from the console
CommitcreatedNew commit pushed to the environment branch
UnqueuecreatedstartedThe Builder has picked up the build from the queue
ClonestartedcloningThe Builder starts cloning the project repository
InstallcloninginstallingThe Builder starts installing the project’s dependencies
GenerateinstallinggeneratingThe Builder executes the pre-build command, if any
Compileinstalling, generatingcompilingThe Builder compiles background functions
PublishcompilingpublishingThe Builder stores the background function bundles
SuccesspublishingsucceedThe build has completed successfully
Failcloning, installing, generating, compiling, publishingfailedThe build has failed. Can happen at various steps. Diagnostics and logs are displayed in the console