Neon now has realtime: Live SQL with full reactivity. Try it in Beta today
/APIs & SDKs/Functions, storage and data/triggers

Neon CLI command: triggers

Create and manage function triggers that invoke a Neon Function on a cron schedule or when an object is created

The triggers command manages function triggers on a branch. A trigger invokes a Neon Function on a cron schedule (schedule), or when an object is created in an Object Storage bucket (storage_object_created). Use it to run recurring work like a nightly report or cleanup job, or to process uploads as they land, without a separate scheduler. You deploy the function with neon functions deploy, then point a trigger at it by slug.

Triggers are branch-scoped. Pass --project-id and --branch to target a branch, or let the CLI resolve them from your context file. Triggers can also be inherited: a trigger created on a parent branch is visible on its child branches, where the Inherited column shows true. An inherited trigger stays disabled on the child until you enable it there with neon triggers enable.

Subcommands: create, delete, disable, enable, get, list, update

neon triggers list

Lists the triggers on the branch.

neon triggers list [options]
OptionDescriptionTypeDefaultRequired
--branchBranch ID or namestring—No
--project-idProject IDstring—No
neon triggers list --project-id solitary-heart-93902637 --branch main

The Type column shows each trigger's type, currently schedule or storage_object_created. Schedule holds the cron for schedule triggers; Storage holds the bucket (and prefix, if set) for storage triggers.

Output
Trigger ID                                    Name            Type                    Function Slug  Function Path  Schedule   Storage        Enabled  Inherited  Next Run At
trigger-12345678-90ab-cdef-1234-567890abcdef  nightly-report  schedule                child404       /              0 6 * * *                 true     false      2026-09-11T06:00:00.000000Z
trigger-abcdef12-3456-7890-abcd-ef1234567890  on-upload       storage_object_created  ingest         /object                       assets logos/  true     false

neon triggers get

Shows a single trigger by ID.

neon triggers get <id> [options]
OptionDescriptionTypeDefaultRequired
--branchBranch ID or namestring—No
--project-idProject IDstring—No
neon triggers get trigger-12345678-90ab-cdef-1234-567890abcdef --project-id solitary-heart-93902637 --branch main --output json
Show output
{
  "type": "schedule",
  "trigger_id": "trigger-12345678-90ab-cdef-1234-567890abcdef",
  "function_slug": "child404",
  "name": "nightly-report",
  "function_path": "/",
  "schedule": {
    "cron": "0 6 * * *"
  },
  "enabled": true,
  "version": 1390408,
  "next_run_at": "2026-09-11T06:00:00.000000Z",
  "inherited": false
}

A storage_object_created trigger has storage_object_created (bucket and optional prefix) in place of schedule, and no next_run_at:

Show output
{
  "type": "storage_object_created",
  "trigger_id": "trigger-abcdef12-3456-7890-abcd-ef1234567890",
  "function_slug": "ingest",
  "name": "on-upload",
  "function_path": "/object",
  "storage_object_created": {
    "bucket_name": "assets",
    "prefix": "logos/"
  },
  "enabled": true,
  "version": 1390512,
  "inherited": false
}

neon triggers create

Creates a trigger that invokes a function on a cron schedule or when an object is created. --function-slug and --name are required, and the name must be unique on the branch. Choose the type with one of:

  • --cron for a schedule trigger, a five-field UTC cron expression.
  • --bucket for a storage_object_created trigger, with an optional --prefix to match only object keys under that prefix.

--cron and --bucket are mutually exclusive (Pass --cron or --bucket, not both.), and --prefix requires --bucket.

Object-created triggers (--bucket and --prefix) require Neon CLI 4.21.0 or later. On an older CLI, --bucket isn't recognized and create reports a missing --cron argument instead.

neon triggers create [options]
OptionDescriptionTypeDefaultRequired
--bucketObject-storage bucket to watch (storage_object_created)string—No
--cronFive-field UTC cron expression, e.g. '*/15 * * * *'string—No
--enabledWhether the trigger runs (default true)boolean—No
--function-pathPath the invocation is sent to (default '/')string—No
--function-slugSlug of the function to invokestring—Yes
--nameTrigger name (unique per branch)string—Yes
--prefixObject-key prefix to match (requires --bucket on create)string—No
--branchBranch ID or namestring—No
--project-idProject IDstring—No

By default the invocation is sent to / and the trigger is enabled. Use --function-path to send it to another route, and --enabled false to create it in a disabled state.

A schedule trigger:

neon triggers create --function-slug child404 --name nightly-report --cron '0 6 * * *' --project-id solitary-heart-93902637 --branch main
Output
Trigger ID     trigger-12345678-90ab-cdef-1234-567890abcdef
Name           nightly-report
Type           schedule
Function Slug  child404
Function Path  /
Schedule       0 6 * * *
Enabled        true
Inherited      false
Next Run At    2026-09-11T06:00:00.000000Z

A storage trigger that fires when an object is created under logos/ in the assets bucket:

neon triggers create --function-slug ingest --name on-upload --bucket assets --prefix 'logos/' --function-path /object --project-id solitary-heart-93902637 --branch main

neon triggers update

Updates a trigger. Pass at least one of --function-slug, --name, --function-path, or --enabled, plus the field matching the trigger's type: --cron for a schedule trigger, or --bucket/--prefix for a storage_object_created trigger. With no fields to change, the command returns an error. The type is fixed at creation, so passing --cron to a storage trigger, or --bucket/--prefix to a schedule trigger, is rejected (Trigger <id> is type <type>; ...). Changing a schedule recomputes Next Run At.

neon triggers update <id> [options]
OptionDescriptionTypeDefaultRequired
--bucketObject-storage bucket to watch (storage_object_created)string—No
--cronFive-field UTC cron expressionstring—No
--enabledWhether the trigger runsboolean—No
--function-pathPath the invocation is sent tostring—No
--function-slugSlug of the function to invokestring—No
--nameTrigger name (unique per branch)string—No
--prefixObject-key prefix to matchstring—No
--branchBranch ID or namestring—No
--project-idProject IDstring—No

Reschedule a schedule trigger:

neon triggers update trigger-12345678-90ab-cdef-1234-567890abcdef --cron '*/30 * * * *' --project-id solitary-heart-93902637 --branch main

Change the prefix a storage trigger matches:

neon triggers update trigger-abcdef12-3456-7890-abcd-ef1234567890 --prefix 'incoming/' --project-id solitary-heart-93902637 --branch main

neon triggers enable

Enables a trigger so it runs on its schedule. Enabling recomputes Next Run At.

neon triggers enable <id> [options]
OptionDescriptionTypeDefaultRequired
--branchBranch ID or namestring—No
--project-idProject IDstring—No
neon triggers enable trigger-12345678-90ab-cdef-1234-567890abcdef --project-id solitary-heart-93902637 --branch main

neon triggers disable

Disables a trigger without deleting it. A disabled trigger keeps its definition but does not run, and its Next Run At is cleared. Re-enable it with neon triggers enable.

neon triggers disable <id> [options]
OptionDescriptionTypeDefaultRequired
--branchBranch ID or namestring—No
--project-idProject IDstring—No
neon triggers disable trigger-12345678-90ab-cdef-1234-567890abcdef --project-id solitary-heart-93902637 --branch main

neon triggers delete

Deletes a trigger.

neon triggers delete <id> [options]
OptionDescriptionTypeDefaultRequired
--branchBranch ID or namestring—No
--project-idProject IDstring—No
neon triggers delete trigger-12345678-90ab-cdef-1234-567890abcdef --project-id solitary-heart-93902637 --branch main
Output
Trigger trigger-12345678-90ab-cdef-1234-567890abcdef deleted
Was this page helpful?
Edit on GitHub

On this page

Copy neon init command