Cloudflare DevelopersCD
Cloudflare Developers9mo ago
9 replies
Boragorn

I might have identified a bug related to

I might have identified a bug related to waitForEvent.

Here's the relevant code:
export class SimpleWorkflow extends WorkflowEntrypoint<
  Env,
  SimpleWorkflowPayload
> {
  async run(event: WorkflowEvent<SimpleWorkflowPayload>, step: WorkflowStep) {
    console.log("Simple workflow started", event.payload);

    await step.do("testing timeout", async () => {
      console.log(`Initializing test: ${event.payload.name}`);
      const eventResponse = await step.waitForEvent("waiting for event", {
        type: "test",
        timeout: 10000,
      });
      console.log("Test event received", eventResponse);
      return { status: "initialized" };
    });

    console.log("workflow complete");
  }
}


Whenever waitForEvent fails due to a timeout exception, the step is retried as expected.

However, once the step re-runs, I’m no longer able to send events—the workflow appears to be running, but the event cannot be received or triggered anymore.
Was this page helpful?