Datetime inside lambda giving same time for different invocations.

0

I have a lambda function that writes to dynamodb and inside the lambda, I fetch current time and pass it as well with data as the write time. I have noticed that in the DB, the datetime for the write is same for multiple invocations although they were not together. at least a gap of few minutes was there before each invocation. however, in db, the datetime is the exact including seconds for a few calls that were within a timespan of 15 minutes or so. Can I know why?

asked a year ago443 views
2 Answers
0
Accepted Answer

Are you getting the current time inside the handler or outside the handler? The code that runs outside the handler is invoked only once. In your case, you need to do it inside the handler.

If this is not the case, it would be good if you can share your code.

profile pictureAWS
EXPERT
Uri
answered a year ago
profile pictureAWS
EXPERT
reviewed 10 months ago
0

Hey, thanks. It's outside the handler. I will put it inside.

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions