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.

已提問 4 年前檢視次數 572 次
1 個回答
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.

已回答 4 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南