How to retry failed jobs?




Is there a conventional jets or lambda way of retrying jobs that failed (error thrown)? Something like sidekiq, with exponential backoff…

Right now, what i’m doing is catching the appropriate error and invoking another job.

The job is calling another API, which could fail and give me an 5xx response.



Currently, Jets doesn’t do extra retry logic. There is some retry behavior built into Lambda. The devil is in the details.

The retry behavior of Lambda depending on a variety of factors. Docs:

Depending on the type of error, the type of invocation, and the client or service that invokes the function, the retry behavior and the strategy for managing errors varies.

Jets Jobs that called from a CloudWatch Scheduled Event are asynchronous. For asynchronous Lambda function calls, from the docs:

Lambda retries function errors twice.

There’s not much control over the retry logic. IE: Exponentially, immediately, etc.

You can optionally associate a dead-letter queue on the function to capture the events after all 3 attempts have failed. The dead-letter queue is part of the function properties It’s up to the application to figure out how to handle items in the dead letter queue.

For API Gateway, Jets uses the Lambda Proxy integration, which calls the Lambda function synchronously. So there are no retries. From the docs:

For synchronous invocation, the service is responsible for retries.

Hope that helps.