-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AutoPublishAlias not working in cloudformation #876
Comments
Did your stack update complete successfully? I just created a stack with I could see which version my alias was pointing at by going to the lambda function in the console, clicking "Qualifiers", and verifying that the alias pointed at the latest version (for me, version 2 of my function). |
Thanks @keetonian . Yeah my stack updated successfully but didnt created new version. You are saying i Because the above configuration didnt worked for me . |
Ok, I'll try the exact steps you recorded. Did you update the stack with |
No i didn't tried it with |
I believe AutoPublishAlias is a SAM feature instead of it's cloudformation superset. I have my project function configure as below, which is perfectly fine, just fyr. ProfilePostFunction:
Type: "AWS::Serverless::Function"
Properties:
Handler: index.handler
Runtime: nodejs8.10
FunctionName: !Join ["", [ !Ref EnvrType ,"-", "SI-post-profile-image" ] ]
Role: 'arn:aws:iam::45645654645645:role/aiportal-lambda-execution-role'
CodeUri: lambdas/SI-post-profile-image
AutoPublishAlias: dev
DeploymentPreference:
Type: AllAtOnce
Alarms:
# A list of alarms that you want to monitor
- !Ref AliasErrorMetricGreaterThanZeroAlarm
- !Ref LatestVersionErrorMetricGreaterThanZeroAlarm |
SAM templates can be deployed via CloudFormation (Console or CLI). Remaining action item for @keetonian is to try to reproduce via the CloudFormation console. @Private-SO One thing to note, you are using |
@jlhood , Yes my usecase don't need |
@Private-SO I followed the exact steps that you posted in your original post. You are correct in that a new version is not created when following those steps. The reason for this is that, when you update the stack in the CloudFormation console, the original SAM template is not used; rather, the transformed CloudFormation template is used. This means that SAM does not run and is not able to change the Function Version resource for you so that the stack deploys a new version. I can recommend two ways to make this work as expected:
|
If I am using nested stack for functions which are in S3, it is quite count productive to have to touch that nested stack. Is there any way to force the root stack in SAM to reevaluate the nested stack for the function? |
Environment variable changes should also trigger publishing a new version. Plus we can use a dummy environment variable to trigger code updates from the same If you are using SAM, this deficiency of
|
I echo @whereisaaron 's thoughts. Our deployments are right now wrong as changing environment variables is not triggering publishing a new version and any subscription/api pointing to the lambda points to the wrong version. EDIT: |
Hey, the problem had been addressed in latest SAM version by allowing to configure the hash of published Lambda version through |
@whereisaaron did you ever get a solution to this allowing just environment variables to be modified and triggering an update to the alias? This is a severe bug imo, going to have to go and route out whether there is an existing bug filed for it outside of this topic, since the original topic is slightly different (and closed). I've tested it out and the PreTraffic deployment hook successfully triggers giving you the opportunity (in the hook) to catch bugs introduced by env variable changes, but if no alias is updated then what's the point outside the hack of using |
The other related bug is here #413 👍 |
There is a bug, as mentioned in here -> #1497, I am facing the same issue |
This is an issue.
Steps to Reproduce
Below are the lambda functions.
markleV1
markleV2
After deploying the above template i can see that it had produced an alias,version and lambda function.
codeuri
of the above template to like this"CodeUri": "s3://dynamodbputtest/markleV2.zip"
and updated the stack. As said in the documentation since there is an change in thecodeuri
it need to publish a new version and assign alias to the new version. But i didnt see any new version .Am i missing anything?
Any help is appreicated
Thanks
The text was updated successfully, but these errors were encountered: