Introducing the Inngest TypeScript / JavaScript SDK
Join our Discord
Sign up for free

Retries and failures

When functions fail, Inngest can retry them automatically. Whether Inngest retries your function is determined by how it fails.

Failure detection

There are two ways that functions are determined to have failed:

  • A function throws an error:
js
export default createFunction("My Function", "demo/some.event", ({ event }) => {
throw new Error("Something failed!")
})
  • A function returns a non-2xx status code with it's response:
js
export default createFunction("My Function", "demo/some.event", ({ event }) => {
const result = somethingElse()
return {
status: result.ok ? 200 : 500,
body: { message: result.ok ? "success" : "failure" }
}
})

Retry policies

By default, each function is retried 3 times using exponential backoff with jitter. Retries can be customized using the status or statusCode response:

  • 2xx - Successful: this is not a failure, no retry is necessary
  • 4xx - Bad request: this step will not be retried, as this error is irrecovarble
  • 5xx - Server error: something temporarily failed. This will be retried according to the retry policy (3 times, by default).

We're currently working on implementing custom retry policies per step for step functions, documented in this issue.