Wait
The Wait
state is internally used by the StepFunctions
component to add a Wait
workflow state
to a state machine.
You’ll find this component returned by the wait
method of the StepFunctions
component.
Constructor
new Wait(args)
Parameters
-
args
WaitArgs
WaitArgs
assign?
Type Record
<
string
, any
>
Store variables that can be accessed by any state later in the workflow, instead of passing it through each state.
This takes a set of key/value pairs. Where the key is the name of the variable that can be accessed by any subsequent state.
The value can be any JSON value; object, array, string, number, boolean, null.
{ assign: { productName: "product1", count: 42, available: true }}
Or, you can pass in a JSONata expression.
{ assign: { product: "{% $states.input.order.product %}", currentPrice: "{% $states.result.Payload.current_price %}" }}
Learn more about passing data between states with variables.
name
Type string
The name of the state. This needs to be unique within the state machine.
output?
Type Input
<
Record
<
string
, any
>
|
“
{% ${string} %}
”
>
Transform the output of the state. When specified, the value overrides the default output from the state.
This takes any JSON value; object, array, string, number, boolean, null.
{ output: { charged: true }}
Or, you can pass in a JSONata expression.
{ output: { product: "{% $states.input.product %}" }}
Learn more about transforming data with JSONata.
time?
Type Input
<
“
${number} minute
”
|
“
${number} minutes
”
|
“
${number} hour
”
|
“
${number} hours
”
|
“
${number} second
”
|
“
${number} seconds
”
|
“
${number} day
”
|
“
${number} days
”
|
“
{% ${string} %}
”
>
Specify the amount of time to wait before starting the next state.
{ time: "10 seconds"}
Alternatively, you can specify a JSONata expression that evaluates to a number in seconds.
{ time: "{% $states.input.wait_time %}"}
Here wait_time
is a number in seconds.
timestamp?
Type Input
<
string
>
A timestamp to wait till.
Timestamps must conform to the RFC3339 profile of ISO 8601 and it needs:
- An uppercase T as a delimiter between the date and time.
- An uppercase Z to denote that a time zone offset is not present.
{ timestamp: "2026-01-01T00:00:00Z"}
Alternatively, you can use a JSONata expression to evaluate to a timestamp that conforms to the above format.
{ timestamp: "{% $states.input.timestamp %}"}
Methods
next
next(state)
Parameters
-
state
State
Returns State
Add a next state to the Wait
state. After the wait completes, it’ll transition
to the given state
.
sst.aws.StepFunctions.wait({ name: "Wait", time: "10 seconds"}).next(state);