triggerdotdev / trigger.dev

Trigger.dev is the open source background jobs platform for TypeScript.

Home Page:https://trigger.dev/changelog

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[TRI-1996] A failed run isn't resuming properly from the UI

matt-aitken opened this issue · comments

When you "Rerun" job from the UI you get given two options IF the run has failed.

CleanShot 2024-02-26 at 11 17 26@2x

"Run again" works as designed, it creates a new run with the same payload.

But "Retry Job run" should continue the run and retry failed tasks.

To reproduce

  1. Run this job, it will fail where the error is thrown.
client.defineJob({
  id: "test",
  name: "test error handling",
  version: "0.0.1",
  trigger: eventTrigger({
    name: "test.event",
  }),
  run: async (payload, io, ctx) => {
    const result = await io.runTask("todo", async (client) => {
      throw new Error("I'm broken");
      await io.logger.info("I fixed it");
    });

    await io.logger.info("Afterwards");
  },
});
  1. Modify the code by commenting out the thrown error.
  2. Press the "Retry Job run" button in the UI.
  3. Notice that the run fails again with the error cached.

What might be happening?

  • Check that errors are not being cached in runTask. Only successful results should be.
  • Check that the ContinueRunService is working correctly.

TRI-1996