#2146·chalice

SQS Event Source fails on redeployment

Author: paranoidroroCreated Sep 1, 2025Updated Sep 1, 2025

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.