This is a minimal* reproduction for a bug in the AWS lambda Node 10.X runtime.
* I'm still honing in on the precise cause to make this smaller.
The lambda runtime nodejs10.x sometimes calls the handler twice with the same event within the same request.
Note this is different than the known "SQS at least once" behaviour, as that would be much less common and have differing request ids.
Example output is included as cloudwatch.log
.
- Create a blank
nodejs10.x
lambda ineu-west-1
- Replace
index.js
with the implementation included - Create a new SQS queue (default options, i.e. not FIFO)
- Set the SQS queue as the event source, with a batch size one 1
- Set an environment variable for QUEUE_URL to the url for the queue
- Reserve a concurrency of 2 for the lambda function
- Add sqs:* permissions to the lambda role for the queue
- Start the lambda with the included
test.json
- Watch the logs in cloudwatch, soon (apx. 1/10) you'll see a "double call"
- Redeploy with STOP=false (top of file) to stop lambda