Functions

Write and deploy functions in the panel's editor, configure triggers, imports, dependencies and environment, and browse logs.

The editor

Open Functions in the navigation rail. The sidebar lists your functions; Add New Function creates one.

The function editor with code in the middle and panels for imported functions, triggers, dependencies and environment on the right

The code editor gives you syntax highlighting, type information for TypeScript and the devkit, and formatting. The panel on the right configures the function:

PanelPurpose
Imported FunctionsImport other functions as @spica-fn/<name>. See Sharing code.
TriggersAdd, configure, enable or disable triggers. Each trigger points to an exported handler.
DependenciesInstall, update and remove npm packages.
EnvironmentAttach environment variables and secrets.

Save builds and deploys the function. The Logs drawer at the bottom shows the function's latest logs while you work.

Logs

The function logs page, opened from the functions sidebar header, shows the logs of all functions on a timeline. Filter by level, function, time range or text, and expand entries for details.

The function logs page with a timeline and a table of log entries

Variables

The Function variables page, also opened from the sidebar header, is where you manage the environment variables and secrets available to functions.

The function variables page listing environment variables

Working with the CLI

Editing in the panel is great for experiments. For team work, keep functions in a repository and use spica dev, which applies your local edits to an instance as you save.