skip to Main Content

For instance Try one failed, Can we pass few parameters to to event object of the next retry by something like below?

event.somevariable = somevalue

If we want do something like that what could be our options?

2

Answers


  1. There’s no way to do that directly in AWS.

    You could use the request ID as a primary key in a DynamoDB table where you store that value, and always look for those values in DynamoDB at the start of a request.

    Login or Signup to reply.
  2. I’m not a fan of Lambda retries. They are run exactly the same as the initial call and if it failed the first time, it will fail on both of the subsequent retries. What changes?

    I’m going to assume that you want to pass along a variable to track which retry is being executed and potentially make changes so that the subsequent retries do succeed – this does make sense. However, unfortunately, you need to look outside of lambda to make this happen.

    DynamoDB is one method which is commonly used, to track the event ID and number of executions however I personally find that to be a faff.

    I’d rather use Amazon SNS to ping a HTTP endpoint on failure, then re-execute my lambda function with different parameters. Just be mindful (in all cases) of idempotency. You should be able to re-execute a lambda multiple times without it causing issues or overwriting what was intended to happen.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search