Q91 — AWS DVA-C02 Ch.3
Question 91 of 100 | ← Chapter 3
A company has deployed a microservices application using Amazon API Gateway, AWS Lambda, Amazon Simple Queue Service (Amazon SQS), and Amazon DynamoDB. A Lambda function adds messages to an SQS FIFO queue. When developers reviewed the application logs, they discovered duplicate items in the DynamoDB table. These items were inserted by another polling function that processes messages from the queue. What is the most likely cause of this issue?
- A. Write operations on the DynamoDB table are being throttled.
- B. The SQS queue is delivering the same message multiple times to the function.
- C. API Gateway is duplicating messages in the SQS queue.
- D. The polling function's timeout is greater than the queue's visibility timeout. ✓
Correct Answer: D. The polling function's timeout is greater than the queue's visibility timeout.
Explanation
Answer D is correct. In this scenario, the polling function's timeout exceeding the queue's visibility timeout can cause the issue. When the polling function's timeout is longer than the queue's visibility timeout, the queue may assume the message was not processed and redeliver it to the function, resulting in duplicate processing and duplicate entries in the DynamoDB table. Option A—throttling of DynamoDB write operations—typically does not directly cause duplicates. Option B—SQS queues do not normally redeliver the same message multiple times under normal operation. Option C—API Gateway does not replicate messages in SQS queues. Therefore, the most likely cause is option D.