SQS Event Source fails on redeployment
- Dominant language
- Python
- Stars
- 11.1k
- Forks
- 1k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 2
Description
Pretty much what it says on the title
I am using the SQS event source decorator, `@app.on_sqs_message(queue='my-queue', batch_size=1)` to trigger a Lambda when there are messages in my queue.
The first deployment is always fine but I get the following error on redeployment:
An error occurred (ResourceConflictException) when calling the
CreateEventSourceMapping operation: An event source mapping with SQS arn ("
arn:aws:sqs:XX-XXXX-X:XXXXXXXXXX:XXXXXX-XXXXXXXX ") and
function (" lambda-XXXXX-XXXXXX ") already exists. Please
update or delete the existing mapping with UUID
XXXXXXX-XXXXX-XXXX-XXXXXX
I am having to delete all the event source mappings on redeploy currently which isn't great. Chalice should check if the event source mapping exists before trying to create one.
Contributor guide
Research direction
Start with the SQS event source decorator, @app.on_sqs_message, and trace the deployment path that calls CreateEventSourceMapping during redeployment. Reproduce a first deployment followed by a redeployment with the same queue and function, then verify that an existing mapping is handled without ResourceConflictException and that the event source remains usable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, python
- Domain
- backend, cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100