Lambda queries do not reflect the database state

0

Hi,

I have a lambda that connects to an Amazon Aurora RDS instance and gets data from it. In the database, I have two tables, Student and Processed. My lambda query returns 5 students from the student table that have not been processed, i.e., their ids do not appear in the Processed table. I'm noticing that when I make an update to the Processed table the changes are not immediately reflected in the lambda result. That is, the lambda still returns students that have been marked as processed. Even though the data in the database has changed. I have verified the updated state of the database manually. Is it possible that the lambda is caching somewhere? I'm executing the lambda from the AWS console so there are no layers there.

I also noticed that if I make a minor change to the lambda code, save it, and then execute it, I get the correct results. Thanks for any help.

preguntada hace 4 años570 visualizaciones
1 Respuesta
0

I figured it out. I was creating the session object outside the lambda handler which caused it to be cached. I moved session creation inside the handler and everything works now.

respondido hace 4 años

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas