1

I have the AWS Lambda function that is triggered by Dynamo Stream (changes that appear in DynamoDB). It worked perfectly. Somehow I started receiving errors in Lambda logs with no lambda code lines specified in stack trace:

java.lang.NullPointerException: java.lang.NullPointerException
java.lang.NullPointerException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)`

As I said, Lambda is triggered by Dynamo Stream events and inside it performs a simple HTTP post request call. What could it be?

Reynard
  • 953
  • 13
  • 27
  • possible duplicate of https://stackoverflow.com/questions/218384/what-is-a-nullpointerexception-and-how-do-i-fix-it – Sunchezz May 15 '19 at 17:22
  • Can you show the code? – Sunchezz May 15 '19 at 17:23
  • @Sunchezz in case of a NPE in the Lambda code it will show the line number in Lambda Handler class. Like here: https://docs.aws.amazon.com/lambda/latest/dg/java-exceptions.html – Reynard May 15 '19 at 21:29
  • @Sunchezz unfortunately, I cannot show the code. – Reynard May 15 '19 at 21:29
  • Then, by only guessing, if you are making requests, and the target is not reachable the response may be null. if there is no null check on the response or any other objects which rely on a successful connection, it will break. Or the response you are expecting, changed. – Sunchezz May 16 '19 at 07:28
  • @Sunchezz thanks for your feedback, but I have all the null checks in the code. Otherwise the stack trace should show the line in Lambda code that caused an error, but it did not. – Reynard May 17 '19 at 08:45
  • Then please contact the AWS support. I can't imagine how anybody here can help you, if we get no code and no other options. And please share your solution here, if you found one, to let others know :) – Sunchezz May 17 '19 at 10:52

1 Answers1

1

Since there is no code available, it's only a guess that maybe you have some sort of ttl (time to live) set on your DynamoDb. Once the items in the DynamoDb are past their ttl, they gets deleted from the table and the deletion event is sent in the dynamo stream as well with the event name as "REMOVE". The payload for "REMOVE" event is very different from that of "INSERT" or "UPDATE" event, maybe that kind of payload from the stream is giving null pointer exception. Specifying again, it's just a guess as I don't have any information about the type of code and issue that you are facing.