Skip to content

Errors in ctx.waitUntil are not captured (Cloudflare) #48

Description

@samuelcolvin

I'm using the following, but surely it should happen by default?

function runAfter(ctx: ExecutionContext, promise: Promise<unknown>) {
  ctx.waitUntil(wrapLogfire(promise))
}

async function wrapLogfire(promise: Promise<unknown>): Promise<void> {
  try {
    await promise
  } catch (error) {
    logfire.reportError('Error in ctx.waitUntil', error as Error)
    throw error
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions