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

Bug: AutoPublishAlias won't create new versions if only layer arn is modified. #7775

Closed
DiscreteTom opened this issue Dec 6, 2024 · 4 comments

Comments

@DiscreteTom
Copy link

Description:

AutoPublishAlias won't create new versions if only layer arn is modified in function's properties.

This will also affect SnapStart since new versions can't be created, users must create the version and modify alias manually.

Steps to reproduce:

  1. Deploy an official hello world example (e.g. python3.9 in my case) with AutoPublishAlias enabled. The first deployment will create version 1 for the function.
  2. Modify the function's property in template.yaml, add a layer with an ARN. E.g. with lambda web adapter's arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerX86:23
  3. sam build then sam deploy. The function is updated but no new versions created.
  4. Modify the layer's arn, e.g. use an old lambda web adapter layer arn: arn:aws:lambda:${AWS::Region}:753240598075:layer:LambdaAdapterLayerX86:22.
  5. sam build then sam deploy. The function is updated but no new versions created.

Observed result:

Add/Modify a layer arn won't create new function versions.

Expected result:

Add/Modify a layer arn should create new function versions.

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

{
  "version": "1.119.0",
  "system": {
    "python": "3.11.8",
    "os": "Linux-6.1.111-120.187.amzn2023.x86_64-x86_64-with-glibc2.34"
  },
  "additional_dependencies": {
    "docker_engine": "25.0.6",
    "aws_cdk": "2.131.0 (build 92b912d)",
    "terraform": "Not available"
  },
  "available_beta_feature_env_vars": [
    "SAM_CLI_BETA_FEATURES",
    "SAM_CLI_BETA_BUILD_PERFORMANCE",
    "SAM_CLI_BETA_TERRAFORM_SUPPORT",
    "SAM_CLI_BETA_RUST_CARGO_LAMBDA"
  ]
}

Add --debug flag to command you are running

@DiscreteTom DiscreteTom added the stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. label Dec 6, 2024
@mbfreder
Copy link

mbfreder commented Dec 9, 2024

Thanks for opening this @DiscreteTom . Setting AutoPublishAliasAllProperties to true creates a new AWS::Lambda::Version when any property in the Lambda function is modified. Please try this and let me know if it works.

@vicheey
Copy link

vicheey commented Dec 11, 2024

The way SAM know to publish a new version or not is by check the hash of a function. With AutoPublishAlias, only a handful of default properties are used fro the hashing. Layer is not one of this default properties. To solve your current issue, theAutoPublishAliasAllProperties should be used to tell SAM to consider Layer and additional properties when creating a hash.

@vicheey vicheey removed the stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. label Dec 11, 2024
@DiscreteTom
Copy link
Author

Thanks for the response. AutoPublishAliasAllProperties works like a charm.

Copy link
Contributor

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

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

No branches or pull requests

3 participants