Used the CDK to create a CloudFront distro with a lambda edge function to add security headers. It failed due to another account using the same name (legacy account that has since then been removed). I tried to re-deploy but it wanted me to destroy the stack fist. Well, it's been 5 days and I still cannot destroy the stack.
I'm aware of the nightmare of Lambda Edge functions and while this may not be a CDK bug, this is an AWS bug to say the least. The Cloudfront distro has been deleted for 5 days. I have no way to manually delete the Lambda Edge functions so I am not not able to deploy my stack. The docs stated https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-edge-delete-replicas.html do not apply as I have no Distro to edit. The CDK destroy method deleted everything so I am not able to do anything.
Reporting as a bug here because the CDK should have a better implementation of deleting these due to the known limitations in AWS.
I have paid support in other accounts but not this one, so I am not even sure what I can do at this point as not having paid support gives me no way to ask to fix this issue...
Reproduction Steps
Create a Cloudfront Distro with a Lambda Edge Function. Then delete it.
What did you expect to happen?
The stack to delete.
What actually happened?
It deleted everything but the Lambda Edge function and now I am in a state that it will not delete and I have no way to delete it.
9:10:18 AM | DELETE_FAILED | AWS::Lambda::Function | assetsCdnedgeFunctionFn889F71D0
Resource handler returned message: "Lambda was unable to delete arn:aws:lambda:us-east-1:117781944281:function:CatalogOlyComCdnProd-assetsCdnedgeFunctionFn889F71-0RRGz4brxZvf:1 because it is a replicated function. Please see our documentation for Deleting Lambda@Ed
ge Functions and Replicas. (Service: Lambda, Status Code: 400, Request ID: 8243f0d8-1c06-4175-9872-0743e9041b08, Extended Request ID: null)" (RequestToken: f7c38014-c4ef-f6e3-4d7c-cb97925d08f9, HandlerErrorCode: InvalidRequest)
new Function (/home/jpsimkins/DevOps/oly-iac-mono-repo/aws/implementations/node_modules/@aws-cdk/aws-lambda/lib/function.ts:625:35)
\_ EdgeFunction.createInRegionFunction (/home/jpsimkins/DevOps/oly-iac-mono-repo/aws/implementations/node_modules/@aws-cdk/aws-cloudfront/lib/experimental/edge-function.ts:141:26)
\_ new EdgeFunction (/home/jpsimkins/DevOps/oly-iac-mono-repo/aws/implementations/node_modules/@aws-cdk/aws-cloudfront/lib/experimental/edge-function.ts:60:14)
\_ CloudFrontWordPressCdn._buildLambdaFunction (/home/jpsimkins/DevOps/oly-iac-mono-repo/aws/implementations/node_modules/@olympusat-devops/oly-cloudfront-templates/src/lib/CloudFrontWordPressCdn.ts:116:27)
\_ new CloudFrontWordPressCdn (/home/jpsimkins/DevOps/oly-iac-mono-repo/aws/implementations/node_modules/@olympusat-devops/oly-cloudfront-templates/src/lib/CloudFrontWordPressCdn.ts:64:32)
\_ new CatalogOlyComCdnProd (/home/jpsimkins/DevOps/oly-iac-mono-repo/aws/implementations/accounts/oly-marketing-prod/us-east-1/src/stacks/catalog.olympusat.com/src/cdn-prod.ts:11:22)
\_ Object.<anonymous> (/home/jpsimkins/DevOps/oly-iac-mono-repo/aws/implementations/accounts/oly-marketing-prod/us-east-1/src/stacks/catalog.olympusat.com/index.ts:29:18)
9:10:18 AM | DELETE_FAILED | AWS::Lambda::Function | assetsCdn/edgeFunction/Fn
Resource handler returned message: "Lambda was unable to delete arn:aws:lambda:us-east-1:117781944281:function:CatalogOlyComCdnProd-assetsCdnedgeFunctionFn889F71-0RRGz4brxZvf:1 because it is a replicated function. Please see our documentation for Deleting Lambda@Ed
ge Functions and Replicas. (Service: Lambda, Status Code: 400, Request ID: 8243f0d8-1c06-4175-9872-0743e9041b08, Extended Request ID: null)" (RequestToken: f7c38014-c4ef-f6e3-4d7c-cb97925d08f9, HandlerErrorCode: InvalidRequest)
9:10:19 AM | DELETE_FAILED | AWS::CloudFormation::Stack | CatalogOlyComCdnProd
The following resource(s) failed to delete: \[assetsCdnedgeFunctionFn889F71D0].
Reported issue here too: https://github.com/aws/aws-cdk/issues/15010
Also, reported to AWS support but since this account has no paid support, I am doubtful I will get much of a response.
Edited by: olyDevOps on Jun 7, 2021 1:16 PM
Edited by: olyDevOps on Jun 7, 2021 1:21 PM