Wait for event
step.waitForEvent(id, options): Promise<null | EventPayload>
- Name
 id- Type
 - string
 - Required
 - required
 - Description
 The ID of the step. This will be what appears in your function's logs and is used to memoize step state across function versions.
- Name
 options- Type
 - object
 - Required
 - required
 - Description
 Options for configuring how to wait for the event.
Properties- Name
 event- Type
 - string
 - Required
 - required
 - Description
 The name of a given event to wait for.
- Name
 timeout- Type
 - string
 - Required
 - required
 - Description
 The amount of time to wait to receive the event. A time string compatible with the ms package, e.g.
"30m","3 hours", or"2.5d"
- Name
 match- Type
 - string
 - Required
 - optional
 - Description
 The property to match the event trigger and the wait event, using dot-notation, e.g.
data.userId. Cannot be combined withif.
- Name
 if- Type
 - string
 - Required
 - optional
 - Description
 An expression on which to conditionally match the original event trigger (
event) and the wait event (async). Cannot be combined withmatch.**Expressions are defined using the Common Expression Language (CEL) with the events accessible using dot-notation. Read our guide to writing expressions for more info. Examples:
event.data.userId == async.data.userId && async.data.billing_plan == 'pro'
// Wait 7 days for an approval and match invoice IDs
const approval = await step.waitForEvent("wait-for-approval", {
  event: "app/invoice.approved",
  timeout: "7d",
  match: "data.invoiceId",
});
// Wait 30 days for a user to start a subscription
// on the pro plan
const subscription = await step.waitForEvent("wait-for-subscription", {
  event: "app/subscription.created",
  timeout: "30d",
  if: "event.data.userId == async.data.userId && async.data.billing_plan == 'pro'",
});
step.waitForEvent() must be called using await or some other Promise handler to ensure your function sleeps correctly.