Skip to content

My 'waitForEvent' gets notified before my workflow is listening for the event? #102

@dejoma

Description

@dejoma
// In the Workflow logs we can see that this is e.g. 3:08:06PM
const eventId = await context.run<string | null>(
      'pdf-export.started',
      async () => {
        const eventId = crypto.randomUUID();
        await invokeLambda('pdfExportContainer', {
          course,
          imageUrl,
          ...lambdaPayload,
          eventId
        });
        return eventId;
      }
    );

  // This part is not relevant
  if (!eventId) {
    await context.run<void>('error.pdf-export.failed', async () => {
      throw new Error('Failed to generate PDF');
    });

    ...
    return;
  }

    // In the Workflow logs we can see that this is e.g. 3:08:08PM meanwhile we notified 
     already one second before that
    const { eventData, timeout } = await context.waitForEvent(
      'pdf-export.completed',
      eventId,
      {
        timeout: '15m'
      }
    );

My issue with the above code is that my lambda function reaches the "notify workflow" function within 5 seconds. And then the context.waitForEvent is not yet called.

What is the average time between these "workflow steps"? Can it be that that takes about 10 seconds?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions