5
votes

I'm experimenting with dynamo db and lambda and am having trouble with the following flow:

Lambda A is triggered by a put to S3 event. It takes the object, an audio file, calculates its duration and writes a record in dynamoDB for each 30 second segment.

Lambda B is triggered by dynamoDB, downloads the file from S3 and operates on the 30 second record defined in the dynamo row.

My trouble is that when I run this flow, function A writes all of the rows required to dynamo, by function B

  • Does not seem to be triggered for each row in dynamo
  • Times out after 5 minutes.

Configuration

  • Function B is set with the highest memory and 5 minute expiration
  • The trigger is set with a batch size of 1 and starting position latest

Things I've confirmed

  • When function B is triggered, the download from S3 happens fast. This does not seem to be the blocker
  • When I trigger function B with a test event it executes perfectly.
  • When I look at the cloudwatch metrics, function B has a nearly 100% error rate in invocation. I can't tell if this means he function was invoked and had an error or could not be invoked at all.

Has anyone had similar issues? Any idea what to check next? Thanks

2
So in the mean time I solved my problem by publishing a message to Sns and getting a lambda triggered that way. Work flawlessly. I'd like to know why the dynamo trigger didn't do what I want if anyone has an idea.Tal Perry
The fact that you are timing means that your function is being invoked, but is getting stuck somewhere. The problem doesn't seem to be the dynamo trigger, but your function itself. Try implementing some detailed logging to find exactly where your function is hanging. Can you possibly include your source in the question? Would make it easier to helpJonathan Seed
I got in the same situation, where the Dynamo triggers sometimes, but it is not predictable. Even i try to use of AWS Dynamo Lambda sample with no changes and still no lack.AlexC

2 Answers

3
votes

I had the same problem, the solution was to create a VERSION from the Lambda and NOT to use the $LATEST Version, but a 'fixed' one.

It is not possible to use the latest ever-changing version to build a trigger upon.

Place to do that: Lambda / Functions / YourLambdaName / Qualifiers Dropdown on the page / Switch versions/aliases / Version Tab -> check that you have a version

If not -> Actions / Publish new version

1
votes

Check for DynamoDB "Stream" is it is enabled on the table.

Checkout this

5 min timeout is default for lambda, you can find this mentioned in forums.