Open Arkano22 opened 1 year ago
Thanks for reporting, I was able to reproduce this.
I don't think this is a bug with our constructs, but rather with the CloudFormation implementation of the LayerVersion
resource. We aren't manually setting the physical name, we're leaving it up to CloudFormation to decide the physical name here. CloudFormation ends up deciding on a physical name that is identical to the logical ID, when they should truncate if necessary.
I have reported this internally, and will provide updates as they become available P88281898
Hey! Is there a temporary solution for this? I currently ran into the same issue.
Also running into this issue, would love a workaround.
@SatyadevGolla I made the logical Id very short and it worked. Hope that helps
Describe the bug
** Couldn't find on the module documentation any way to assign/override the name for the lambda function (search on google also didn't throw any particular solution)
From CDK I was able to make use of the BucketDeployment while compiling my project locally; But during the actual deployment on CloudFormation I received an error due to a Lambda layer that gets generated through the BucketDeployment construct which broke the ARN max length.
Expected Behavior
CDK Lib to be either notify of this prior to deploying to CloudFormation, or for the module to be smart enough to appropriately shorten the name length to fit within the ARN standards
Current Behavior
Build succeeds locally, but while the deployment of the CDK template occurs on CloudFormation, it fails with the following error
The above layer is created as part of the Bucket Deployment utility provided by the CDK module
Reproduction Steps
Create a stack which includes a construct with an id with the following setup
this.customUploader = new Uploader(this,
IdIsANameWithALengthOfAtLeast58Characters, {...})
Length should be defined only by [A-Z][a-z] characters as special characters i.e.
-
are removed from the concatenation.Inside the construct include the BucketDeployment with a setup similar to
const bucketDeployment = new BucketDeployment(this, 'IdIsANameWithALengthOfAtLeast24Characters', {...})
The above will generate during the CloudFormation deployment a Lambda function with the following concatenation
arn:aws:lambda:region:123456789012:layer:IdIsANameWithALengthOfAtLeast58CharactersIdIsANameWithALengthOfAtLeast24CharactersAwsCliLayerRandomIDDisambiguator
Which then fails the generation of the stack due to the error mentioned above
Possible Solution
Couple of possible choices:
Id
to trim/truncate on it as to avoid surpassing the Lambda standard for ARN generationAdditional Information/Context
No response
CDK CLI Version
2.46.0
Framework Version
No response
Node.js Version
14
OS
MacOS Ventura 13.3.1
Language
Typescript
Language Version
4.8.4
Other information
No response