aws / aws/aws-cdk

(cloudfront): Name length of cache policy

Open
#23,272 2 comments 0 reactions 0 assignees View on GitHub
@aws-cdk/aws-cloudfront bug effort/small p3
Dominant language
TypeScript
Stars
12.9k
Forks
4.6k
Avg merge
2d 3h
Merged PRs (30d)
83

Description

### Describe the bug

When introducing an unnamed CachePolicy to a CloudFront distribution which is deeply nested in constructs the automatic generated name could grow beyond 128 characters, in spite of #18918 / #18953. This will cause the CDK to raise an exception

### Expected Behavior

CDK is able to figure out how to make a properly unique policy name without raising exceptions

### Current Behavior

CDK is unable to figure out how to make a properly unique policy name without raising exceptions.

In the reproduction case, the offending policy's id is a single character, which is still too long.

### Reproduction Steps

Attempt to synth the project that can be cloned from here: https://github.com/jnawk/cdk-cfront-policy-name-too-long

### Possible Solution

_No response_

### Additional Information/Context

_No response_

### CDK CLI Version

2.54.0

### Framework Version

2.54.0

### Node.js Version

16.18.1

### OS

Ubuntu 22.04.1 LTS

### Language

Typescript

### Language Version

TS4.9.4

### Other information

_No response_

Contributor guide

Open the contributing guide

Research direction

Clone the linked reproduction project and run synth to observe the generated CachePolicy name failure. Trace how deeply nested unnamed CloudFront policies receive names; done means synthesis succeeds with a unique policy name no longer than 128 characters.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cloud, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.