Skip to content

Conversation

@Abogical
Copy link
Member

Issue #6176

Closes #6176.

Reason for this change

Using fromBucket to source lambda code can have the unintended silent effect of not updating when the code is updated on the S3 bucket.

Description of changes

  • A note is added to the docs on this beahvior
  • A warning is added if objectVersion is not set.

Describe any new or updated permissions being added

No permissions added.

Description of how you validated changes

Unit tests to confirm the emission of warnings only if an object version is not set.

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@aws-cdk-automation aws-cdk-automation requested a review from a team June 20, 2025 12:52
@github-actions github-actions bot added repeat-contributor [Pilot] contributed between 3-5 PRs to the CDK bug This issue is a bug. effort/small Small work item – less than a day of effort p1 labels Jun 20, 2025
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(This review is outdated)

@Abogical Abogical changed the title docs(aws-lambda): Warn users on using fromBucket without setting objectVersion docs(lambda): Warn users on using fromBucket without setting objectVersion Jun 20, 2025
@Abogical Abogical changed the title docs(lambda): Warn users on using fromBucket without setting objectVersion docs(lambda): warn users on using fromBucket without setting objectVersion Jun 20, 2025
@aws-cdk-automation aws-cdk-automation dismissed their stale review June 20, 2025 13:23

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Jun 24, 2025
@aemada-aws aemada-aws self-assigned this Jun 25, 2025
'/Stack/Bucket',
'objectVersion is not defined for S3Code.fromBucket(). The lambda will not be updated automatically if the code in the bucket is updated. ' +
'This is because CDK/Cloudformation does not track changes on the source S3 Bucket. It is recommended to either use S3Code.fromAsset() instead or set objectVersion. ' +
'[ack: @aws-cdk/aws-lambda:codeFromBucketObjectVersionNotSpecified]'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'[ack: @aws-cdk/aws-lambda:codeFromBucketObjectVersionNotSpecified]'
'[ack: @aws-cdk/aws-lambda:codeFromBucketObjectVersionNotSpecified]',

this fixes the lint failure

@Abogical Abogical force-pushed the code-from-bucket-warn branch from 6884652 to dc38028 Compare June 26, 2025 10:25
@Abogical Abogical force-pushed the code-from-bucket-warn branch from dc38028 to a3b2f08 Compare June 26, 2025 11:14
@Abogical
Copy link
Member Author

@Mergifyio update

@mergify
Copy link
Contributor

mergify bot commented Jun 27, 2025

update

✅ Branch has been successfully updated

@mergify
Copy link
Contributor

mergify bot commented Jun 27, 2025

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 43f5a58
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify
Copy link
Contributor

mergify bot commented Jun 27, 2025

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit 41311a2 into main Jun 27, 2025
18 checks passed
@mergify mergify bot deleted the code-from-bucket-warn branch June 27, 2025 11:09
@github-actions
Copy link
Contributor

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 27, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug This issue is a bug. contribution/core This is a PR that came from AWS. effort/small Small work item – less than a day of effort p1 repeat-contributor [Pilot] contributed between 3-5 PRs to the CDK

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lambda Function Code.FromBucket() does not update "Code Entry Type" in AWS console

3 participants