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

(cloudfront): (custom originId handling issue for multiple behaviours with same origin) #22758

Closed
patricksuter opened this issue Nov 3, 2022 · 2 comments · Fixed by #22830
Closed
Assignees
Labels
@aws-cdk/aws-cloudfront Related to Amazon CloudFront bug This issue is a bug. effort/small Small work item – less than a day of effort in-progress This issue is being actively worked on. p2

Comments

@patricksuter
Copy link
Contributor

Describe the bug

When setting custom originIds for CloudFront origins und the new Distribution construct there is an issue when using the same origin for multiple behaviours. The first behaviour uses the correct custom originId as TargetOriginId but every behaviour after that use the auto-generated originId instead of the correct custom originId.

Expected Behavior

The custom originId is used for every usage of the origin in the behaviors in the TargetOriginId property.

Current Behavior

Only the first behaviour using a given origin uses the correct custom originId in the TargetOriginId property. Every behaviour after that uses the auto-generated id.

Reproduction Steps

Create origin with custom originId and use it in at least two behaviours.

Possible Solution

Prepared the following fix: #22756

Additional Information/Context

No response

CDK CLI Version

2.50.0

Framework Version

No response

Node.js Version

v14.19.1

OS

OSX

Language

Typescript

Language Version

No response

Other information

No response

@patricksuter patricksuter added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Nov 3, 2022
@github-actions github-actions bot added the @aws-cdk/aws-cloudfront Related to Amazon CloudFront label Nov 3, 2022
@peterwoodworth peterwoodworth added p2 effort/small Small work item – less than a day of effort in-progress This issue is being actively worked on. and removed needs-triage This issue or PR still needs to be triaged. labels Nov 3, 2022
@peterwoodworth
Copy link
Contributor

Thanks for reporting and submitting a fix @patricksuter, we'll try to take a look at your PR soon

@mergify mergify bot closed this as completed in #22830 Nov 8, 2022
mergify bot pushed a commit that referenced this issue Nov 8, 2022
… same origin (#22830)

When setting custom `originId`s for CloudFront origins und the new `Distribution` construct there is an issue when using the same origin for multiple behaviours. The first behaviour uses the correct custom `originId` as `TargetOriginId` but every behaviour after that use the auto-generated `originId` instead of the correct custom id.

fixes #22758

Improved the handling of the `originId` to correctly pick either the auto-generated `originId` or the explicitly set `originId` of the origin. The issue was caused by the auto-generated `originId` to always be set on the internal list of origins which caused issues when adding more than one behaviour since the wrong id was returned when re-using an existing origin from the internal list.

----

### All Submissions:

* [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

github-actions bot commented Nov 8, 2022

⚠️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.

iliapolo pushed a commit that referenced this issue Nov 9, 2022
… same origin (#22830)

When setting custom `originId`s for CloudFront origins und the new `Distribution` construct there is an issue when using the same origin for multiple behaviours. The first behaviour uses the correct custom `originId` as `TargetOriginId` but every behaviour after that use the auto-generated `originId` instead of the correct custom id.

fixes #22758

Improved the handling of the `originId` to correctly pick either the auto-generated `originId` or the explicitly set `originId` of the origin. The issue was caused by the auto-generated `originId` to always be set on the internal list of origins which caused issues when adding more than one behaviour since the wrong id was returned when re-using an existing origin from the internal list.

----

### All Submissions:

* [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*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
@aws-cdk/aws-cloudfront Related to Amazon CloudFront bug This issue is a bug. effort/small Small work item – less than a day of effort in-progress This issue is being actively worked on. p2
Projects
None yet
3 participants