Boris Tane
05/14/2022, 5:31 PMimport { StringParameter } from "aws-cdk-lib/aws-ssm";
const rootDomain = StringParameter.valueForStringParameter(this, `/myApp/domain`);
new ApiGatewayV1Api(this, "Api", {
customDomain: {
domainName: `api.${rootDomain}`,
hostedZone: rootDomain,
},
routes: {
"GET /notes": "src/list.main",
},
});
I get this
Error: Cannot determine scope for context provider hosted-zone.
This usually happens when one or more of the provider props have unresolved tokens
it works only when the hostedZone
is a hardcoded string and not the value from ssm parameter store.
my dev deps:
"@serverless-stack/cli": "^1.1.0",
"@serverless-stack/resources": "^1.1.0",
"@tsconfig/node14": "^1.0.1",
"@types/aws-lambda": "^8.10.70",
"@types/node": "<15.0.0",
"aws-cdk-lib": "2.24.0"
Frank
Frank
Frank
Frank
Boris Tane
05/18/2022, 4:45 AMBoris Tane
05/18/2022, 4:47 AMBoris Tane
05/18/2022, 4:50 AMSupriya N
06/03/2022, 7:39 PMBoris Tane
06/04/2022, 6:51 AMconst hostedZoneId = ssm.StringParameter.valueForStringParameter(this, `hosted-zone-id`);
// @ts-expect-error
this.api = new sst.ApiGatewayV1Api(this, "api", {
customDomain: {
cdk: {
domainName: apig.DomainName.fromDomainNameAttributes(this, "domain", {
domainName: `${subDomain}.${domain}`,
domainNameAliasTarget: "",
domainNameAliasHostedZoneId: hostedZoneId,
}),
},
},
});