Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/core/src/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,15 +340,17 @@ export function workflowEntrypoint(workflowCode: string) {
const now = Date.now();
for (const event of events) {
if (event.eventType === 'wait_created') {
const resumeAt = event.eventData.resumeAt as Date;
const resumeAt = event.eventData.resumeAt
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the world should return resumeAt as a date - so if this is working in vercel and local worlds, this this looks like a postgres world implementation issue. The real fix is postgres world should match the interface and return a date

The zod return type for resumeAt is already meant to be a date:

https://github.com/vercel/workflow/blob/main/packages/world/src/events.ts#L82-L82

? new Date(event.eventData.resumeAt)
: undefined;
const hasCompleted = events.some(
(e) =>
e.eventType === 'wait_completed' &&
e.correlationId === event.correlationId
);

// If wait has elapsed and hasn't been completed yet
if (!hasCompleted && now >= resumeAt.getTime()) {
if (!hasCompleted && resumeAt && now >= resumeAt.getTime()) {
const completedEvent = await world.events.create(runId, {
eventType: 'wait_completed',
correlationId: event.correlationId,
Expand Down