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 example fails deployment #20962

Closed
ezrover opened this issue Jul 2, 2022 · 6 comments · Fixed by #31301
Closed

cloudfront example fails deployment #20962

ezrover opened this issue Jul 2, 2022 · 6 comments · Fixed by #31301
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 p2

Comments

@ezrover
Copy link

ezrover commented Jul 2, 2022

Describe the bug

The sample for adding a custom ResponseHeaderPolicy doesnt not work. Apply the example from

https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront.ResponseHeadersPolicy.html

results in 6:52:43 PM | CREATE_FAILED | AWS::CloudFront::ResponseHeadersPolicy | dev2Respo...dersPolicy75419A62
Resource handler returned message: "Invalid request provided: AWS::CloudFront::ResponseHeadersPolicy" (RequestToken: ****, HandlerErrorCode: InvalidRequest)

Expected Behavior

Work as described in the document https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront.ResponseHeadersPolicy.html

Current Behavior

results in 6:52:43 PM | CREATE_FAILED | AWS::CloudFront::ResponseHeadersPolicy | dev2Respo...dersPolicy75419A62
Resource handler returned message: "Invalid request provided: AWS::CloudFront::ResponseHeadersPolicy" (RequestToken: ****, HandlerErrorCode: InvalidRequest)

Reproduction Steps

build a simple cdk application with the sample from https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront.ResponseHeadersPolicy.html

Possible Solution

No response

Additional Information/Context

"dependencies": {
"aws-cdk-lib": "^2.30.0",
"constructs": "^10.1.43",
"cff-tools": "0.6.0"
},
"devDependencies": {
"@types/aws-lambda": "^8.10.101",
"@types/jest": "^28.1.4",
"@types/node": "^17.0.23",
"@typescript-eslint/eslint-plugin": "^5.29.0",
"@typescript-eslint/parser": "^5.29.0",
"aws-cdk": "^2.30.0",
"aws-lambda": "^1.0.7",
"esbuild": "^0.14.48",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^8.5.0",
"eslint-import-resolver-typescript": "^3.1.1",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^26.5.3",
"eslint-plugin-prettier": "^4.2.1",
"jest": "^28.1.2",
"prettier": "^2.7.1",
"ts-jest": "^28.0.5",
"ts-node": "^10.8.1",
"typescript": "^4.7.4",

"@aws-cdk/assert": "2.30.1"

}

CDK CLI Version

"aws-cdk": "^2.30.0",

Framework Version

No response

Node.js Version

v17.9.0

OS

Mac

Language

Typescript

Language Version

4.7.4

Other information

import * as iam from 'aws-cdk-lib/aws-iam';
import * as s3 from 'aws-cdk-lib/aws-s3';
import * as cdk from 'aws-cdk-lib';

import * as cloudfront from 'aws-cdk-lib/aws-cloudfront';

import * as origins from 'aws-cdk-lib/aws-cloudfront-origins';
import * as wafv2 from 'aws-cdk-lib/aws-wafv2';

import * as acm from 'aws-cdk-lib/aws-certificatemanager';
import * as route53 from 'aws-cdk-lib/aws-route53';
import * as targets from 'aws-cdk-lib/aws-route53-targets';

@ezrover ezrover added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jul 2, 2022
@github-actions github-actions bot added the @aws-cdk/aws-cloudfront Related to Amazon CloudFront label Jul 2, 2022
@ezrover
Copy link
Author

ezrover commented Jul 3, 2022

@comcalvi I created a sample project for you to try https://github.com/ezrover/aws-cdk-ResponseHeadersPolicy-sample

@peterwoodworth
Copy link
Contributor

The error CloudFormation is throwing here isn't helpful in determining what's actually wrong with the template, so it's hard to say if there's an actual error here.

What I think is happening is that you aren't replacing the dummy values in our example and CloudFormation is detecting this, or CloudFormation doesn't like some combination of values seen in the example. Could you try to deploy this with values that you'd realistically use and see if you're still running into errors?

@peterwoodworth peterwoodworth added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed needs-triage This issue or PR still needs to be triaged. labels Jul 7, 2022
@peterwoodworth peterwoodworth changed the title (module name): (short issue description) cloudfront example fails deployment Jul 7, 2022
@ezrover
Copy link
Author

ezrover commented Jul 7, 2022 via email

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Jul 8, 2022
@blimmer
Copy link
Contributor

blimmer commented Aug 9, 2022

You might be running into this issue I recently reported: #21524

@peterwoodworth
Copy link
Contributor

It's possible these are separate issues. I'm unable to deploy just a minimal responseheaderspolicy with just a name. I'm reporting to cloudformation to implement better error handling

@peterwoodworth peterwoodworth added the effort/small Small work item – less than a day of effort label Aug 10, 2022
@peterwoodworth peterwoodworth self-assigned this Feb 15, 2023
@peterwoodworth peterwoodworth removed their assignment Oct 16, 2023
@mergify mergify bot closed this as completed in #31301 Sep 4, 2024
mergify bot pushed a commit that referenced this issue Sep 4, 2024
…ection (#31301)

### Issue # (if applicable)

Closes #20962

### Reason for this change

Update the documentation to have a deployable example.

### Description of changes

Set `modeBlock` to false when `reportUri` is set.
You cannot specify a ReportUri when ModeBlock is true.

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-responseheaderspolicy-xssprotection.html

### Description of how you validated changes

Updated the tests

### 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*
Copy link

github-actions bot commented Sep 4, 2024

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 Sep 4, 2024
pahud pushed a commit to pahud/aws-cdk that referenced this issue Sep 9, 2024
…ection (aws#31301)

### Issue # (if applicable)

Closes aws#20962

### Reason for this change

Update the documentation to have a deployable example.

### Description of changes

Set `modeBlock` to false when `reportUri` is set.
You cannot specify a ReportUri when ModeBlock is true.

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-responseheaderspolicy-xssprotection.html

### Description of how you validated changes

Updated the tests

### 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*
xazhao pushed a commit to xazhao/aws-cdk that referenced this issue Sep 12, 2024
…ection (aws#31301)

### Issue # (if applicable)

Closes aws#20962

### Reason for this change

Update the documentation to have a deployable example.

### Description of changes

Set `modeBlock` to false when `reportUri` is set.
You cannot specify a ReportUri when ModeBlock is true.

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-responseheaderspolicy-xssprotection.html

### Description of how you validated changes

Updated the tests

### 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*
GavinZZ pushed a commit that referenced this issue Sep 12, 2024
…ection (#31301)

### Issue # (if applicable)

Closes #20962

### Reason for this change

Update the documentation to have a deployable example.

### Description of changes

Set `modeBlock` to false when `reportUri` is set.
You cannot specify a ReportUri when ModeBlock is true.

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-cloudfront-responseheaderspolicy-xssprotection.html

### Description of how you validated changes

Updated the tests

### 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 subscribe to this conversation on GitHub. Already have an account? Sign in.
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 p2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants