I've launched this stack and needed to update it's Lamdba function, I've made some amendments and hit deploy, a new version of function was saved, however Lambda application still refers to the first version of function, I've tried to update stack, deploy from local environment and nothing worked, the only way was to re-create the whole stack with a link to modified functions in yml template.
2 Answers
I haven't tested it yet, but it seems that the source of the problem was in S3 event notification settings, the 'Destination' section contains an ARN link which points to the 1st version of the Lambda function. So navigate to S3 bucket name - Properties tab - Event notifications section - Edit notification - Destination section - Lambda function. Hope this helps.
My solution might be old, but still working. You can put code version number in the file name then pass it as parameter to CF template. CF will not update function unless it knows something is different there, so just update zip isn't enough, you need to change its name. This way you'll re-create lambda only, not the whole stack.
For example, instead of
CodeUri: s3://bucket/myfunc.zip
use
CodeUri: s3://bucket/myfunc-v0.1.2.zip
and of course update values EVERY time the code changes.
-
As I've posted in comment above, this solution's not working, it updates the function, creates a new version but the stack still refers to the 1st version.– MikeCommented Feb 3, 2021 at 16:14
-
Stack cannot refer to the old function unless it was updated outside of the stack. Something else (NOT the sack) - definitely can. Cannot say more without necessary details.– PutnikCommented Feb 5, 2021 at 14:45
CodeUri: s3://vod-template-qw1456/vod-TranscodingFunction.zip
: you did NOT use the code version there.