Skip to main content

Call the `onFailure` hook for runs that were canceled, expired, etc

Currently the onFailure hook only gets called for failures that happen during your code execution, i.e. the code is actually running on your machine.

We need to change this or maybe add a different hook for any type of failure… this is annoying right now. We did it like this because it's a lot harder for us to spin up a machine just to run the onFailure hook. We will also need to know if the task needs to spun up because it actually implements that otherwise we waste compute and your concurrency spinning up a machine for no reason. Painful! But we will do it because it's annoying.

2 comments

Comments2

  • An Anonymous User

    •

    Feb 24

    @mattaitken this would be a great feature! I attempted to add some additional context to the docs but my PR got auto-closed for not being in the allowlist (posting it here for visibility)

    https://github.com/triggerdotdev/trigger.dev/pull/3117 . It took me some help from Iss to understand why my onCancel cleanup wasn’t running in some scenarios. It has the same (understandable) limitations as what you described for onFailure here, but from a DX perspective, that doesn’t feel very declarative. I would at least recommend describing it in the docs to take into account, for the time being at least.

  • An Anonymous User

    •

    Feb 24

    @mat