I am just adding route53 record for the custom dom...
# help
g
I am just adding route53 record for the custom domain of my user pool
new route53.ARecord(this, "CustomerUserPoolDomainARecord", {
zone: _props_?.hostedZone!,
recordName: domainName,
target: route53.RecordTarget.fromAlias(
new route53Targets.UserPoolDomainTarget(userPoolDomain)
),
});
What does this error means?
Error: Cannot find asset at /Users/gbc9720/Documents/projects/food_delivery_backend/.build/lib/runtime
at new AssetStaging (/Users/gbc9720/Documents/projects/food_delivery_backend/node_modules/@aws-cdk/core/lib/asset-staging.ts:113:13)
at new Asset (/Users/gbc9720/Documents/projects/food_delivery_backend/node_modules/@aws-cdk/aws-s3-assets/lib/asset.ts:68:21)
at AssetCode.bind (/Users/gbc9720/Documents/projects/food_delivery_backend/node_modules/@aws-cdk/aws-lambda/lib/code.ts:183:20)
at new Function2 (/Users/gbc9720/Documents/projects/food_delivery_backend/node_modules/@aws-cdk/aws-lambda/lib/function.ts:335:29)
at SingletonFunction.ensureLambda (/Users/gbc9720/Documents/projects/food_delivery_backend/node_modules/@aws-cdk/aws-lambda/lib/singleton-lambda.ts:93:12)
at new SingletonFunction (/Users/gbc9720/Documents/projects/food_delivery_backend/node_modules/@aws-cdk/aws-lambda/lib/singleton-lambda.ts:32:32)
at new AwsCustomResource (/Users/gbc9720/Documents/projects/food_delivery_backend/node_modules/@aws-cdk/custom-resources/lib/aws-custom-resource/aws-custom-resource.ts:194:22)
at UserPoolDomain.get cloudFrontDomainName [as cloudFrontDomainName] (/Users/gbc9720/Documents/projects/food_delivery_backend/node_modules/@aws-cdk/aws-cognito/lib/user-pool-domain.ts:98:39)
at UserPoolDomainTarget.bind (/Users/gbc9720/Documents/projects/food_delivery_backend/node_modules/@aws-cdk/aws-route53-targets/lib/userpool-domain.ts:12:28)
at new RecordSet (/Users/gbc9720/Documents/projects/food_delivery_backend/node_modules/@aws-cdk/aws-route53/lib/record-set.ts:124:73)
r
Not really sure but worth checking your aws-cdk versions match the sst supported version
g
I am using version 1.126.0
r
what version of sst?
g
its version 0.50.2
f
@Gerald does the error go away if you comment out the
new route53.ARecord
line?
g
@Frank Yeah it goes away. I'd try the same stack using purely cdk and it does work.
I think the error is here https://github.com/aws/aws-cdk/blob/747eb7cf5dba4514241103ffebc49e03261d25a9/packages/%40aws-cdk/aws-cognito/lib/user-pool-domain.ts#L129 when using sst, it throws Error: Resolution error: Supplied properties not correct for "CfnRecordSetProps" aliasTarget: supplied properties not correct for "AliasTargetProperty" dnsName: required but missing.
It just says There was an error synthesizing your app, no other details
f
Hey @Gerald, sorry for the late follow up. Are you still running up against this issue?
Let me know and I can give it a try on my end.
g
@Frank It worked when I set the domain from the Auth instance. ex.
this.auth = new Auth(this, appName.concat("Cognito"), {
cognito: {
userPool: { ... },
userPoolClient: { .... }
}
});
const userPoolDomain = this.auth.cognitoUserPool!.addDomain("UserPoolDomain", {
customDomain: {
domainName: domainName,
certificate: certificate
}
});
new route53.ARecord(this, "UserPoolDomainARecord", {
zone: hostedZone,
recordName: domainName,
target: route53.RecordTarget.fromAlias(
new route53Targets.UserPoolDomainTarget(userPoolDomain)
),
});
but not when I set the domain like this.
const userPool = new cognito.UserPool(this, 'UserPool', {
userPoolName: capitalize(stage) + appName.concat("UserPool"),
...
})
const userPoolDomain = userPool.addDomain("UserPoolDomain", {customDomain: {
domainName: domainName,
certificate: certificate
}});
this.auth = new Auth(this, appName.concat("Cognito"), {
cognito: {
userPool: userPool,
userPoolClient: userPoolClient
}
});
new route53.ARecord(this, "UserPoolDomainARecord", {
zone: hostedZone,
recordName: domainName,
target: route53.RecordTarget.fromAlias(
new route53Targets.UserPoolDomainTarget(userPoolDomain)
),
});
f
Hey @Gerald, I tried both, both ways worked for me.
Can you double check if
aws-cognito
as a dependency in ur package.json?
Copy code
"@aws-cdk/aws-cognito": "1.126.0",
g
@Frank right. I don't have that package. is it because of that? I'll try it. hehehe!
f
Yup! Give it a try.