aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.65k stars 3.91k forks source link

DnsValidatedCertificate - Failed to create CertificateRequestorResource #7905

Closed jamiepmullan closed 4 years ago

jamiepmullan commented 4 years ago

When running CDK Deploy, I keep getting the error: "Failed to create resource. Cannot read property 'Name' of undefined" From: "CertificateRequestorResource/Default"

10/14 | 13:59:06 | CREATE_FAILED | AWS::CloudFormation::CustomResource | Cert/webCert/CertificateRequestorResource/Default (CertwebCertCertificateRequestorResourceXXXXX) Failed to create resource. Cannot read property 'Name' of undefined new CustomResource (/...../node_modules/@aws-cdk/core/lib/custom-resource.js:23:25)


This is :bug: Bug Report

asterikx commented 4 years ago

@jamiepmullan How did you resolve the issue? Facing the same problem.

asterikx commented 4 years ago

I could get it solved.

I had two hosted zones, example.com and dev.example.com. I was deploying two stacks, one of which issued a certificate for the apex domain and one for the subdomain. I was issuing a certificate for the subdomain before I had one for the apex domain.

Since there was no explicit dependency between the two stacks the CLI deployed the stacks in alphabetical order. Deploying first the stack for the apex domain and then the stack for the subdomain fixed the issue for me. Adding an explicit dependency in the code, e.g. devDnsStack.addDependency(rootDnsStack), should do so too.

lusentis commented 4 years ago

Same issue, single stack with just a couple of resources. Deploys fine sometimes, while other times it fails (4/5 approx). Didn't find a solution so far, except repeating the deploy until it succeeds - definitely looks like a concurrency issue, but cannot figure out what's causing it.