3. First function
Compute functions are built, tested, deployed, and run through the Compute API.
The Suborbital Compute function editor uses the API to provide a low-friction environment for your users to write, build, test, and deploy functions to your Compute instance in a single place.
Alternatively, the Builder API can be used programmatically, if that better suits your use case. (see Step 4).

Compute function editor

A quick way to try the editor is to use the REPL built into the Subo CLI introduced in Step 2. The Subo REPL includes a proxy that makes it easy to connect the hosted editor to your local Compute installation.
By default, it makes the editor accessible on The editor proxy port can be configured with the subo compute deploy core --local --proxy-port <some port> option.
The subdomain points to, i.e. localhost. You may need to substitute a different hostname or IP address depending on your particular network setup.

Editor URLs

To edit a function via the editor, you—or more likely your application—must construct a valid URL to pass to the editor. When working locally, the Subo REPL can generate editor URLs for you automatically.
In a development environment, the URL should have these components:
In a production environment, the URL may look something like this:
The important differences to note between these URLs are the local and public hostnames and HTTP and HTTPS schemes for the editor itself and the &builder= parameter.
Complete documentation for each of the URL parameters can be found here.

Build, test and deploy functions

Once inside the editor, you can edit, build, test, and deploy your functions all in one place.

Executing functions

Once your first function has been built and deployed, it can be run with a request to the Execution API.
export ENV_TOKEN=<token from Step 1>
curl \
--header "Authorization: Bearer $ENV_TOKEN" \
-d 'my friend'
hello, my friend
Please note: If you are invoking the Test API, you will need to import the Editor Token provided by the Control Plane service API instead of the Environment token in the code snippet above.
Last modified 1mo ago