serverless-application-model icon indicating copy to clipboard operation
serverless-application-model copied to clipboard

Changes to function's event source properties don't get applied

Open ljacobsson opened this issue 5 years ago • 2 comments

Description: Scenario: I have a function consuming a Kinesis stream. Due to an error on our side we started receiving some corrupt records which jammed the stream.

I tried to add MaximumRetryAttempts and a DestinationConfig that would send failing batches to an SQS DLQ.

Observed result: The deploy went through, but the changes to the event source configuration did not get applied.

Expected result: The failing records should end up in the DLQ

I tried brute-forcing it by renaming the event, but received error from CloudFormation:

The event source arn (" arn:aws:kinesis:eu-west-1:ACCOUNT_ID:stream/STREAM_NAME ") and function ("FUNCTION_NAME) provided mapping already exists. Please update or delete the existing mapping with UUID 0bde47e2-6165-4cc5-965f-320f82a792f4

ljacobsson avatar Feb 28 '20 08:02 ljacobsson

@ljacobsson Could you please share a sample template to reproduce the issue at our end?

ShreyaGangishetty avatar Feb 28 '20 18:02 ShreyaGangishetty

@ShreyaGangishetty

Sorry for the brevity in my initial report. I've now taken time to make this reproducible.

I've added an example to this repo. Please note that I've anonymised account id and sam bucket name.

In that repo you can find two templates; sam_first_update.yml and sam_second_update.yml. The first one is deploying the event source mapping with default properties, and the second one is adding BisectBatchOnFunctionError: true and MaximumRetryAttempts: 10.

In script.sh I first deploy the sam_first_update.yaml followed by aws lambda list-event-source-mappings followed by the same thing on sam_second_update.yaml. I redirect all output to output.txt.

On lines 148 & 149 you can see that the expected update hasn't been applied.

I hope this helps

ljacobsson avatar Feb 29 '20 09:02 ljacobsson

@ljacobsson thank you for providing the template and reproduction steps. I, unfortunately, couldn't reproduce your bug and from what I can tell it should've been fixed with this PR but that PR was merged before you reported the bug.

I've attached my output here if you want to take a look. I deployed your first template, printed the event source mappings, deployed your second template, re-printed mappings. As you can see in the 2nd print of the mappings the BisectBatchOnFunctionError is set to true and MaximumRetryAttempts is 10. Let us know if the issue persists for you. Thanks.

aaythapa avatar Nov 30 '22 23:11 aaythapa

Closing for now, please re-open if the issue persists

aaythapa avatar Dec 01 '22 20:12 aaythapa