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] generates "Comment" automatically which can be too long. #10211

Closed
laimonassutkus opened this issue Sep 7, 2020 · 3 comments · Fixed by #10266
Closed

[cloudfront] generates "Comment" automatically which can be too long. #10211

laimonassutkus opened this issue Sep 7, 2020 · 3 comments · Fixed by #10266
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. language/python Related to Python bindings p1

Comments

@laimonassutkus
Copy link

When creating a distribution with Distribution (from aws_cdk.aws_cloudfront import Distribution) an Origin access identity is being created with a Comment attribute which can be to long (in fact - for me it is too long and I can not deploy the distribution). I get the following error from CloudFormation:

The parameter Comment is too big. (Service: AmazonCloudFront; Status Code: 400; Error Code: InvalidArgument; Request ID: 138149ac-0858-4ecb-abf7-17d90f671ce1)

Reproduction Steps

  1. Create a stack.
  2. Create another stack inside the stack.
  3. Repeat for few times so the cdk would start generating ridiculously long names.
  4. Create distribution.
  5. cdk deploy

What did you expect to happen?

Distribution created.

What actually happened?

The parameter Comment is too big. (Service: AmazonCloudFront; Status Code: 400; Error Code: InvalidArgument; Request ID: 138149ac-0858-4ecb-abf7-17d90f671ce1)

Environment

  • CLI Version : aws-cli/1.18.49 Python/3.6.0 Windows/10 botocore/1.15.49
  • Framework Version: ?
  • Node.js Version: v12.16.2
  • OS : Windows 10
  • Language (Version): Python3.6

Other

The cdk generates the following template (snippet):

BlaBlaContactCenterCloudFrontDistributionOrigin1S3OriginE9E0DBAE:
    Type: AWS::CloudFront::CloudFrontOriginAccessIdentity
    Properties:
      CloudFrontOriginAccessIdentityConfig:
        Comment: Access identity for BlaBlaCoreMainStackBlaBlaContactCenterUiMainStackBlaBlaContactCenterUiCloudFrontStackBlaBlaContactCenterCloudFrontDistributionOrigin19B3E38BF

This is 🐛 Bug Report

@laimonassutkus laimonassutkus added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Sep 7, 2020
@laimonassutkus
Copy link
Author

Anyone? Hello?

@SomayaB SomayaB changed the title [cloudfront/cloudfront-origins] generates "Comment" automatically which can be too long. [cloudfront] generates "Comment" automatically which can be too long. Sep 8, 2020
@github-actions github-actions bot added the @aws-cdk/aws-cloudfront Related to Amazon CloudFront label Sep 8, 2020
@SomayaB SomayaB added the language/python Related to Python bindings label Sep 8, 2020
@njlynch njlynch added effort/small Small work item – less than a day of effort p1 and removed needs-triage This issue or PR still needs to be triaged. labels Sep 8, 2020
@njlynch
Copy link
Contributor

njlynch commented Sep 8, 2020

Thanks for the bug report.

Unfortunately, the limit isn't explicitly documented anywhere, but a quick test in the CloudFront console suggests the limit is 128 characters. We'll just need to truncate the comment if it's above that.
Screen Shot 2020-09-08 at 18 05 38

@laimonassutkus
Copy link
Author

No problem. Truncating the comment seems a sensible solution.

njlynch added a commit that referenced this issue Sep 9, 2020
The OAI gets a comment that includes the name of the origin it is attached to.
With longer distribution and origin names, this comment can overflow the
(undocumented) 128-character limit. This fix truncates the comment.

I also updated `oai.test.ts` from using the `nodeunitshim` to actually be
written as Jest tests.

fixes #10211
njlynch added a commit that referenced this issue Sep 9, 2020
The OAI gets a comment that includes the name of the origin it is attached to.
With longer distribution and origin names, this comment can overflow the
(undocumented) 128-character limit. This fix truncates the comment.

I also updated `oai.test.ts` from using the `nodeunitshim` to actually be
written as Jest tests.

fixes #10211
@SomayaB SomayaB added the in-progress This issue is being actively worked on. label Sep 9, 2020
@mergify mergify bot closed this as completed in #10266 Sep 10, 2020
mergify bot pushed a commit that referenced this issue Sep 10, 2020
The OAI gets a comment that includes the name of the origin it is attached to.
With longer distribution and origin names, this comment can overflow the
(undocumented) 128-character limit. This fix truncates the comment.

I also updated `oai.test.ts` from using the `nodeunitshim` to actually be
written as Jest tests.

fixes #10211


----

*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. language/python Related to Python bindings p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants