Skip to main content
Neon Docs

Search documentation

Type to search this documentation.

On this pageOverview

Neon CLI command: triggers

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_cr...

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

Lists the triggers on the branch.

Bash
neon triggers list [options]
Option Description Type Default Required
--branch Branch ID or name string — No
--project-id Project ID string — No
Bash
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.

title="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

Shows a single trigger by ID.

Bash
neon triggers get <id> [options]
Option Description Type Default Required
--branch Branch ID or name string — No
--project-id Project ID string — No
Bash
neon triggers get trigger-12345678-90ab-cdef-1234-567890abcdef --project-id solitary-heart-93902637 --branch main --output json
Show output
JSON
{
  "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
JSON
{
  "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
}

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.

Bash
neon triggers create [options]
Option Description Type Default Required
--bucket Object-storage bucket to watch (storage_object_created) string — No
--cron Five-field UTC cron expression, e.g. '*/15 * * * *' string — No
--enabled Whether the trigger runs (default true) boolean — No
--function-path Path the invocation is sent to (default '/') string — No
--function-slug Slug of the function to invoke string — Yes
--name Trigger name (unique per branch) string — Yes
--prefix Object-key prefix to match (requires --bucket on create) string — No
--branch Branch ID or name string — No
--project-id Project ID string — 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:

Bash
neon triggers create --function-slug child404 --name nightly-report --cron '0 6 * * *' --project-id solitary-heart-93902637 --branch main
title="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:

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

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.

Bash
neon triggers update <id> [options]
Option Description Type Default Required
--bucket Object-storage bucket to watch (storage_object_created) string — No
--cron Five-field UTC cron expression string — No
--enabled Whether the trigger runs boolean — No
--function-path Path the invocation is sent to string — No
--function-slug Slug of the function to invoke string — No
--name Trigger name (unique per branch) string — No
--prefix Object-key prefix to match string — No
--branch Branch ID or name string — No
--project-id Project ID string — No

Reschedule a schedule trigger:

Bash
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:

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

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

Bash
neon triggers enable <id> [options]
Option Description Type Default Required
--branch Branch ID or name string — No
--project-id Project ID string — No
Bash
neon triggers enable trigger-12345678-90ab-cdef-1234-567890abcdef --project-id solitary-heart-93902637 --branch main

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.

Bash
neon triggers disable <id> [options]
Option Description Type Default Required
--branch Branch ID or name string — No
--project-id Project ID string — No
Bash
neon triggers disable trigger-12345678-90ab-cdef-1234-567890abcdef --project-id solitary-heart-93902637 --branch main

Deletes a trigger.

Bash
neon triggers delete <id> [options]
Option Description Type Default Required
--branch Branch ID or name string — No
--project-id Project ID string — No
Bash
neon triggers delete trigger-12345678-90ab-cdef-1234-567890abcdef --project-id solitary-heart-93902637 --branch main
title="Output"
INFO: Trigger trigger-12345678-90ab-cdef-1234-567890abcdef deleted
Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu