inngest.json|cue
All Inngest functions are defined as inngest.json
or inngest.cue
files. The file is generated by the inngest init
command, but you can create a file manually or edit it as needed. You can use Cue, which is a superset of JSON for additional language features.
Configuration docs
Here's an example inngest.json
file with annotations for what each component is:
json
{"name": "Send SMS Dispatch","id": "prompt-deer-ede40d","triggers": [{"event": "worker.dispatched","definition": {"format": "cue","synced": false,"def": "file://./events/worker-dispatched.cue"}}],"steps": {"step-1": {"id": "step-1","path": "file://./steps/send-sms-dispatch","name": "Send SMS Dispatch","runtime": {"type": "docker"}},"step-2": {"id": "step-2","path": "file://./steps/my-second-step","name": "Send followup SMS","runtime": {"type": "docker"},"after": [{"step": "step-1"}]}}}
Function triggers
A function can have 1 or more triggers which are defined in the following format. As a given event is received or schedule is executed, the function is executed starting with the first step. There are two types of triggers: Events and Schedules.
Event triggers
json
{"event": "worker.dispatched","definition": {"format": "cue","synced": false,"def": "file://./events/worker-dispatched.cue"}}
Scheduled triggers
Scheduled triggers are configured as cron expressions, eg:
json
{"name": "Send summary","id": "prompt-deer-ede40d","triggers": [{ "cron": "0 12 * * *" } // The function automatically runs on this schedule.],}
Steps
The list of steps is an object, with each step using a unique key id
and it's own step configuration. A function can have 1 to n steps. For more information about steps, check out the Step Functions documentation.
json
"steps": {"step-1": {"id": "step-1","path": "file://./steps/send-sms-dispatch","name": "Send SMS Dispatch","runtime": {"type": "docker"}},"step-2": {"id": "step-2","path": "file://./steps/log-confirmation-for-admin","name": "Log confirmation for admin","after": {"step": "step-1", // The ID of a previous step."wait": "24h", // This will wait 24h before running, after step 1 completes.},"runtime": {"type": "docker"}}
Runtimes
Runtimes are defined within each step's configuration. A runtime specifies how the function runs. There are multiple runtimes available:
docker
: indicates that the step should run code within a containerhttp
: indicates that the step should execute an HTTP fetch (instead of running code).