Upstash Documentation

context.waitForEvent

1 min read

context.waitForEvent pauses workflow execution until a given event occurs or a timeout is reached.

Default timeout value is 7 days.

Arguments#

stepIdstringrequired#

A unique identifier for the step.

eventIdstringrequired#

A unique identifier for the event to wait on.

timeoutnumber|string#

The maximum time to wait before continuing execution.

  • String format: Human‑readable duration (e.g., "10s", "2h", "1d").
  • Number format: Duration in seconds (e.g., 60, 3600).

Defaults to 7d (7 days).

Response#

eventDatastring|object#

The data passed in when the event is triggered via notify().

timeoutboolean#

true if execution resumed because the timeout elapsed, false if resumed due to the event being received.

Usage#