Skip to content
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: Support updating version when things other than CodeUri Changes #413

Closed
rmmeans opened this issue May 2, 2018 · 11 comments
Assignees

Comments

@rmmeans
Copy link

rmmeans commented May 2, 2018

Description:

Per the documentation, AutoPublishAlias only supports publishing another function version when the CodeUri changes. While having AutoPublishAlias in its current state is still beneficial, I have found this has caused much confusion and even bugs that took quite some time to track down. Specifically, when things such as environment variables are changed on the stack.

The "gotcha" that occurs is because an environment variable might be passed as a stack parameter (for instance). When doing a stack update and updating the parameter, everything appears to execute cleanly. The stack change set picks up that the function needs to be updated, etc and the update is marked as successful. This causes the false belief that your update got applied successfully, only on close inspection of the lambda function do you discover that the lambda function was updated, but a new version was not tied to the alias.

I am curious if there is plans to remove this limitation? While the documentation does spell this out clearly, unless someone updating the stack knows that function(s) in the stack are using the AutoPublishAlias feature and knows about this caveat - they they might think an update was successful with no other action needed.

@digioak-zz
Copy link

Appears to be a bug in how we process AutoPublishAlias. We're going to look deeper into a potential solution.

@nick-romano0
Copy link

Just wanted to bump this, it's been an issue for us as well. Our issue is when changing memory allocations.

@brettstack
Copy link
Contributor

This is similar to #479 for APIs only deploying when the Swagger changes. We do have a proposal for APIs to always deploy even when we can't detect a change #660. However, I believe that Lambda won't allow you to create a new version of a Function if there have been no changes at all, making this solution not viable in this case.

We could detect changes to the entire Function configuration itself, however, we don't currently transform anything based on Parameter values which we would need to do to cover this issue completely.

@lanefelker
Copy link

Any updates on this? Is there a solution to make a new lambda version created by environment variable change be tied to the alias?

@chris-malley-alertme
Copy link

Also an issue for us; we use an environment variable to change log level and should to be able to update this without rebuilding the code.

@nwb-ilan
Copy link

nwb-ilan commented Nov 27, 2019

I don't understand the use for AutoPublishAlias if it doesn't support configuration changes such as env variable.
The workaround that comes to mind is to aws lambda update-alias on all the functions in the stack to the '$latest' version after every sam deploy, but that defeats the purpose of having AutoPublishAlias.
Seems like using '$latest' as one of the alias routes is not an option, so that leaves the option of aws lambda publish-version and then aws lambda update-alias, defeating the purpose of AutoPublishAlias
Am I missing something?

@keetonian
Copy link
Contributor

Similar to #1305 for environment variables.
This would be good to support, look at #1305 at how to implement this change.

@driverpt
Copy link

Any updates on this one?

@hoffa
Copy link
Contributor

hoffa commented Dec 9, 2022

Adding AWS::LanguageExtensions to the Transform can help in some situations (specifically when the property is supported by AutoPublishAlias and uses intrinsic functions), see #2533.

@hoffa
Copy link
Contributor

hoffa commented Dec 14, 2022

Relaying from #2418:

There's been a few similar requests (e.g. #413). We can't update the most straightforward way as it would be a backward incompatible change (would cause many redeployments).

We could however consider an opt-in approach. Something like this (just rough idea):

MyFunction:
  Type: AWS::Serverless::Function
  Properties:
    Timeout: 10
    AutoPublishAlias: live
    AutoPublishAdditionalProperties:
      - Timeout
    ...

@aaythapa
Copy link
Contributor

aaythapa commented Feb 6, 2023

Closing this, the fix will be released over the coming weeks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests