Open romor opened 2 years ago
I'm having the same error, despite using Route53.
Looks like the alpha construct either fails to create the AWS::AppSync::DomainName or a dependsOn is missing from the AWS::AppSync::DomainNameApiAssociation resource.
I was able to get this working by using the Cfn constructs for the domain name and association:
const certificate = cdk.aws_certificatemanager.Certificate.fromCertificateArn(
this,
"cert",
APPSYNC_CERT_ARN,
);Ï
const appsyncDomainName = new aws_appsync.CfnDomainName(
this,
'AppsyncDomainName',
{
certificateArn: certificate.certificateArn,
domainName: "my.domain.com",
}
);
const api = new appsync.GraphqlApi(this, "Api", {
name: "my-api",
// Omit the domainName object
...
});
const assoc = new aws_appsync.CfnDomainNameApiAssociation(
this,
'MyCfnDomainNameApiAssociation',
{
apiId: api.apiId,
domainName: "my.domain.com",
}
);
Looks like the alpha construct either fails to create the AWS::AppSync::DomainName or a dependsOn is missing from the AWS::AppSync::DomainNameApiAssociation resource.
I was able to get this working by using the Cfn constructs for the domain name and association:
const certificate = cdk.aws_certificatemanager.Certificate.fromCertificateArn( this, "cert", APPSYNC_CERT_ARN, );Ï const appsyncDomainName = new aws_appsync.CfnDomainName( this, 'AppsyncDomainName', { certificateArn: certificate.certificateArn, domainName: "my.domain.com", } ); const api = new appsync.GraphqlApi(this, "Api", { name: "my-api", // Omit the domainName object ... }); const assoc = new aws_appsync.CfnDomainNameApiAssociation( this, 'MyCfnDomainNameApiAssociation', { apiId: api.apiId, domainName: "my.domain.com", } );
@cdills hmm, I've tried your approach and I'm still seeing the same error. The only difference is I'm creating the cert inline, but I wouldn't have thought that would cause any problems.
Edit: apparently that's exactly what caused the problem,. The certificate can't be created in the same run. When I commented out the association and built the certificate, and then uncommented the association the next run, it worked perfectly.
Describe the bug
Trying to add a custom domain name to AppSync fails during cdk deploment with error
Resource of type 'AWS::AppSync::DomainNameApiAssociation' with identifier 'null' was not found.
This might be related to the fact that the
Route53
service is not used, as the DNS is hosted outside of AWS.Expected Behavior
Deployment of cdk stack works and custom domain name is mapped to the AppSync API.
Current Behavior
During
cdk deploy
the following error appears:Resource of type 'AWS::AppSync::DomainNameApiAssociation' with identifier 'null' was not found.
Reproduction Steps
This is the TypeScript code used in the cdk stack:
APPSYNC_CERT_ARN
refers to the certificate's ARN inus-east-1
region (while AppSync resides ineu-central-1
).As I do not use
Route53
service but host the DNS myself, there is no further code forRoute53
configuration. Of course, the DNS entry exists and points to the AWS appsync URLxxx.appsync-api.eu-central-1.amazonaws.com
.Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.19.0
Framework Version
No response
Node.js Version
v14.19.1
OS
Debian Linux 11.3
Language
Typescript
Language Version
No response
Other information
No response