DEV Community

Amartya Jha
Amartya Jha

Posted on

Losing events from AWS lambda?

Hello everyone, I have been building venture-backed startups for over 4 years now, and security has always been a challenge. Trust me, identifying impactful bugs and dedicating the team's time to fixing them is another struggle - one that I wanted to fix.

Currently, I am building CodeAnt AI, backed by YC. We have made it a priority to develop this as a tool that tackles real pain points for developers.

Here is an example: We deployed our tool in a company, scanned their codebase, and discovered a missing Deadletter queue in AWS Lambda.

Transaction events failing

Let's understand the impact of this bug. When AWS Lambda sends events to an SQS queue and encounters failures, it could be due to network partitions or sending too much data for SQS to handle. In such cases, AWS retries the failed events a certain number of times (around 3). If all retries fail, the event is discarded without storage. This means losing the entire event data, with potential consequences, especially if it's a transaction event.

Added a Deadletter queue

CodeAnt fixed this by suggesting Deadletter queue. AWS Lambda now sends all failed events to this queue. When SQS is back up, the Deadletter queue resends these failed events, ensuring no loss of transaction data in our case.

Would love it if you guys would try CodeAnt AI, and give me some feedback - https://github.com/marketplace/codeant-ai.

We detect and auto-fix bad code, like security vulnerabilities, code antipatterns, complex functions, dead & duplicate code etc.

Top comments (0)