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

fix(cloudfront): custom originId not used for multiple behaviors with same origin #22830

Merged
merged 3 commits into from
Nov 8, 2022

Conversation

patricksuter
Copy link
Contributor

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 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:

Adding new Unconventional Dependencies:

  • This PR adds new unconventional dependencies following the process described here

New Features

  • Have you added the new feature to an integration test?
    • 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

@gitpod-io
Copy link

gitpod-io bot commented Nov 8, 2022

@github-actions github-actions bot added beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK bug This issue is a bug. effort/small Small work item – less than a day of effort p2 labels Nov 8, 2022
@aws-cdk-automation aws-cdk-automation requested a review from a team November 8, 2022 12:09
@patricksuter
Copy link
Contributor Author

@mrgrain here is the new PR that covers #22756

@mergify
Copy link
Contributor

mergify bot commented Nov 8, 2022

⚠️ The sha of the head commit of this PR conflicts with #22756. Mergify cannot evaluate rules on this PR. ⚠️

@mergify
Copy link
Contributor

mergify bot commented Nov 8, 2022

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).

@mrgrain
Copy link
Contributor

mrgrain commented Nov 8, 2022

Thanks again @patricksuter looks all good for the automation to take over now.

@patricksuter
Copy link
Contributor Author

@mrgrain thanks for the quick reaction, nice to see the fix coming back! should I close the other PR or do you prefer to close/delete it?

@mrgrain
Copy link
Contributor

mrgrain commented Nov 8, 2022

@mrgrain thanks for the quick reaction, nice to see the fix coming back! should I close the other PR or do you prefer to close/delete it?

I've already closed it. 😅 The automation didn't like having two PRs with the same commit hashes.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

@mergify mergify bot merged commit 2f1e2e9 into aws:main Nov 8, 2022
@mergify
Copy link
Contributor

mergify bot commented Nov 8, 2022

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).

iliapolo pushed a commit that referenced this pull request 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
beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK bug This issue is a bug. effort/small Small work item – less than a day of effort p2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(cloudfront): (custom originId handling issue for multiple behaviours with same origin)
3 participants