4
votes

I enabled streams on my dynamoDB table. As items are modified, a lambda function is triggered. I think I set up everything correctly both on the lambda trigger side, permissions, and dynamodb side. I also ran my lambda function with test data and it succeeded. However, when items are modified in the table, the trigger did not start my lambda function. Instead, I got the following error:

Batch size: 100 Last processing result: PROBLEM: Function call failed

Any idea what's the best way to debug this? I went on CloudWatch logs but there were no logs associated with the trigger/stream.

Thanks.

Edit: Logs for the lambda function (not its dynamodb trigger). The trigger didn't generate any log statements.

START RequestId: 3a08eedc-f0de-11e8-9008-033b48d2cb67 Version: $LATEST  18:16:28 END RequestId: 3a08eedc-f0de-11e8-9008-033b48d2cb67  18:16:28 REPORT RequestId: 3a08eedc-f0de-11e8-9008-033b48d2cb67 Duration: 81.85 ms Billed Duration: 100 ms Memory Size: 128 MB Max Memory Used: 30 MB

3
Q1: where did you see the "Batch size: 100 Last processing result: PROBLEM: Function call failed" ? Q2: what does "no logs associated with the trigger/stream." mean? where there any logs at all for the lambda (even though not related to the trigger/stream)? If there were, can you post them? Q3: Is this lambda invoked by a different event source? Q4 :How much RAM is allocated for that lambda?Itay Maman
Q1: I saw this msg when I click on the dynamodb trigger in the lambda console. Q2: Actually I don't think I set up logs with the trigger. How do you set up logs for the trigger? Thanks.Sarah Guo
@ItayMaman, I updated the post with the log statements. The ram is 128 MB.Sarah Guo
can you share the code of the lambda?Itay Maman
I think the issue has to do with the while loops and the batchgetitems and scans. I considered either doing recursion like you said or using async/await. But for the former I don't know if recursion stack will trigger other problems. And for the latter, it feels really unintuitive. Another issue is aws.documentClient in node.js uses callbacks instead of promises. So for the sake of simplicity I am switching to Java. Java and Python don't have the async issues that's in javascript/node.js.Sarah Guo

3 Answers

1
votes

I ran into this issue today.

  1. I debugged it by manually triggering the lambda with the Test button on the top of the main lambda page. It showed the error output trying to run my lambda.
  2. The reason I had an error was the handler parameter as I had a non-standard javascript function name and I forgot to configure that in my lambda.
0
votes

In my case, my lambda role did not have permissions to write to the SNS and the lambda code was writing to a SNS. So i added a policy to the lambda role giving it permissions to write to any SNS topic.

-1
votes

This sounds like a possible use-case for Rookout if you need to follow variable values in your live Lambda in a situation where you're not able to generate logs and running it locally isn't going to give you real-world event trigger data.