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

feat(lambda-event-sources): S3EventSource requires Bucket instead of IBucket #25782

Closed
wants to merge 6 commits into from

Conversation

Styerp
Copy link
Contributor

@Styerp Styerp commented May 30, 2023

Cloning #25368
Closes #23940
Closes #4323


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

@gitpod-io
Copy link

gitpod-io bot commented May 30, 2023

@github-actions github-actions bot added the repeat-contributor [Pilot] contributed between 3-5 PRs to the CDK label May 30, 2023
@aws-cdk-automation aws-cdk-automation requested a review from a team May 30, 2023 14:23
@github-actions github-actions bot added effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p1 labels May 30, 2023
@Styerp
Copy link
Contributor Author

Styerp commented May 30, 2023

Reposting #25368 (comment)

API surface changes says changes would cause builds to fail -- that will not happen here. Underlying objects didn't access Bucket methods on the object passed into this function, either directly or indirectly. All properties and objects being used were already available on the IBucket, which was the driving rationale to ease this input type.

While this is ostensibly an API Surface Change, it is NOT a breaking surface change.

Behavior changes say "even though the user didn't change their code, the CloudFormation template that gets synthesized is now different." The integration tests prove this is not the case -- the CFN generated is identical.

Build will continue to fail because of the "Breaking API Changes". Guidance on how y'all handle this would be great. Clarification Request

@aws-cdk-automation aws-cdk-automation added the pr/reviewer-clarification-requested The contributor has requested clarification on feedback, a failing build, or a failing PR Linter run label May 30, 2023
@Styerp Styerp changed the title S3 event source feat(lambda-event-sources): S3EventSource requires Bucket instead of IBucket May 30, 2023
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.

The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.

A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.

@mrgrain
Copy link
Contributor

mrgrain commented May 30, 2023

@rix0rrr Any idea why jsii-diff would be failing here:

API elements with incompatible changes:
err  - PROP aws-cdk-lib.aws_lambda_event_sources.S3EventSource.bucket: type aws-cdk-lib.aws_s3.IBucket (formerly aws-cdk-lib.aws_s3.Bucket): aws-cdk-lib.aws_s3.IBucket does not extend aws-cdk-lib.aws_s3.Bucket [changed-type:aws-cdk-lib.aws_lambda_event_sources.S3EventSource.bucket]

This seems like an okay change to me.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: c6ff065
  • Result: FAILED
  • Build Logs (available for 30 days)

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

@mrgrain mrgrain added the pr-linter/exempt-readme The PR linter will not require README changes label May 30, 2023
@aws-cdk-automation aws-cdk-automation dismissed their stale review May 30, 2023 14:52

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

@otaviomacedo
Copy link
Contributor

@rix0rrr Any idea why jsii-diff would be failing here:

API elements with incompatible changes:
err  - PROP aws-cdk-lib.aws_lambda_event_sources.S3EventSource.bucket: type aws-cdk-lib.aws_s3.IBucket (formerly aws-cdk-lib.aws_s3.Bucket): aws-cdk-lib.aws_s3.IBucket does not extend aws-cdk-lib.aws_s3.Bucket [changed-type:aws-cdk-lib.aws_lambda_event_sources.S3EventSource.bucket]

This seems like an okay change to me.

The problem here is that bucket is not only a constructor argument, but also a public property. With this change, the following would break:

const bucket = new Bucket(...);
const source = new S3EventSource(bucket, ...);

source.bucket.addCorsRule(...); // <-- Consumers expect this to be a Bucket

I'm not sure if there's a valid use case for accessing the bucket property like this (it was probably made public by accident). But technically, it's a breaking change.

@aws-cdk-automation
Copy link
Collaborator

This PR has been in the BUILD FAILING state for 3 weeks, and looks abandoned. To keep this PR from being closed, please continue work on it. If not, it will automatically be closed in a week.

@aws-cdk-automation
Copy link
Collaborator

This PR has been deemed to be abandoned, and will be automatically closed. Please create a new PR for these changes if you think this decision has been made in error.

@aws-cdk-automation aws-cdk-automation added the closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. label Jun 28, 2023
mergify bot pushed a commit that referenced this pull request Feb 8, 2024
…28943)

### Issue # (if applicable)

Closes #4323 

### Reason for this change

S3EventSource should accept `IBucket` instead of `Bucket`.
`aws_s3.Bucket.from_bucket_name(...)` or `aws_s3.Bucket.from_bucket_arn(...)`, etc. returns aws_s3.IBucket type

### Description of changes

Based on @otaviomacedo 's comment in #25782 , a new class `S3EventSourceV2` is implementd to accept `IBucket` instead of `Bucket`. And avoids breaking changes.

### Description of how you validated changes

- unit test
- integration test

### Checklist
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
TheRealAmazonKendra pushed a commit that referenced this pull request Feb 9, 2024
…28943)

### Issue # (if applicable)

Closes #4323 

### Reason for this change

S3EventSource should accept `IBucket` instead of `Bucket`.
`aws_s3.Bucket.from_bucket_name(...)` or `aws_s3.Bucket.from_bucket_arn(...)`, etc. returns aws_s3.IBucket type

### Description of changes

Based on @otaviomacedo 's comment in #25782 , a new class `S3EventSourceV2` is implementd to accept `IBucket` instead of `Bucket`. And avoids breaking changes.

### Description of how you validated changes

- unit test
- integration test

### Checklist
- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. p1 pr/reviewer-clarification-requested The contributor has requested clarification on feedback, a failing build, or a failing PR Linter run pr-linter/exempt-readme The PR linter will not require README changes repeat-contributor [Pilot] contributed between 3-5 PRs to the CDK
Projects
None yet
4 participants