Skip to content

(cloudfront): Name length of cache policy #18918

@ghost

Description

What is the problem?

When introducing a CachePolicy to a CloudFront distribution via CDK the automatic generated name could grow beyond 128 characters. This will cause the CloudFormation stack to fail as the request will be answered as a bad request.

Reproduction Steps

This appears if the constructs and stacks are nested and the parent logical ids are rather long.

What did you expect to happen?

CDK should not generate names longer than the limit to avoid those errors as the naming generation is sometimes hard to track.

What actually happened?

The CFN message is rather useless as we figured that root cause out by reproducing the error with all params in the management console. The CFN message reads: Resource handler returned message: "Invalid request provided: AWS::CloudFront::CachePolicy"

No further errors are provided.

CDK CLI Version

2.8.0

Framework Version

2.8.0

Node.js Version

16.13.2

OS

Windows 11

Language

Typescript

Language Version

3.9.10

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-cloudfrontRelated to Amazon CloudFrontbugThis issue is a bug.in-progressThis issue is being actively worked on.p1

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions