Sam Hulick
12/22/2021, 5:50 PM${Token[TOKEN.1210]}
. is there some way to evaluate those?
or, really, I’m just trying to figure out the output of api.url
(sst.Api
).thdxr
12/22/2021, 6:05 PMSam Hulick
12/22/2021, 6:05 PMdev-microservices-api-base | CREATE_FAILED | AWS::CloudFront::Distribution | ApiDist7600D0E0 | Resource handler returned message: "Invalid request provided: The parameter origin name cannot contain a colon. (Service: CloudFront, Status Code: 400, Request ID: e00470cc-dbd0-496f-adf0-df008aa3fea2, Extended Request ID: null)" (RequestToken: 7a0a5711-1460-1fa3-de3c-efbe92b7e986, HandlerErrorCode: InvalidRequest)
and I’m not sure what’s wrong with the URL origin I’m passing to CloudFrontSam Hulick
12/22/2021, 6:05 PMorigin: new origins.HttpOrigin(
this.restApi.url.replace('https://', '').replace(/:\d+$/, '')
),
thdxr
12/22/2021, 6:05 PMthdxr
12/22/2021, 6:06 PMSam Hulick
12/22/2021, 6:06 PMSam Hulick
12/22/2021, 6:06 PMSam Hulick
12/22/2021, 6:10 PMorigin: new origins.HttpOrigin(this.restApi.httpApi.apiEndpoint),
Sam Hulick
12/22/2021, 6:11 PMthdxr
12/22/2021, 6:12 PMthdxr
12/22/2021, 6:12 PMthdxr
12/22/2021, 6:13 PMSam Hulick
12/22/2021, 6:18 PMSam Hulick
12/22/2021, 6:21 PMnew origins.HttpOrigin('<http://api-blah.site.net|api-blah.site.net>')
Frank
Fn::Sub
, Fn::Split
, etcFrank
this.restApi.url.replace('https://', '')
Sam Hulick
12/22/2021, 6:28 PMFrank
.replace(/:\d+$/, '')
using split
, replace, and then join
?Sam Hulick
12/22/2021, 6:28 PMthis.restApi.url
is the issue. its value is ${Token[TOKEN.1210]}
Frank
this.restApi.url.replace('https://', '')
without the .replace(/:\d+$/, '')
part? Run sst build
, and share the block in CFN template in .build/cdk.out
. Let’s see if CDK translated that to intrinsic functionSam Hulick
12/22/2021, 6:32 PMthdxr
12/22/2021, 6:33 PMthdxr
12/22/2021, 6:34 PMFrank
${var}${foo}
will get translated intrinsic functionFrank
Sam Hulick
12/22/2021, 6:36 PM"TargetOriginId": "devmicroservicesapibaseApiDistOrigin1694CA258",
Sam Hulick
12/22/2021, 6:36 PM"DomainName": {
"Fn::GetAtt": [
"RestApi135E9C73",
"ApiEndpoint"
]
},
Sam Hulick
12/22/2021, 6:36 PM.replace()
thdxr
12/22/2021, 6:46 PMSam Hulick
12/22/2021, 6:49 PMGetAtt
. https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-apigatewayv2-api.html#aws-resource-apigatewayv2-api-return-valuesSam Hulick
12/22/2021, 6:50 PMFn.split
.. maybe I can do something with thatSam Hulick
12/22/2021, 6:56 PM"DomainName": {
"Fn::Select": [
1,
{
"Fn::Split": [
":",
{
"Fn::GetAtt": ["RestApi135E9C73", "ApiEndpoint"]
}
]
}
]
}
Sam Hulick
12/22/2021, 6:57 PMthdxr
12/22/2021, 6:58 PMSam Hulick
12/22/2021, 6:58 PMSam Hulick
12/22/2021, 6:59 PMSam Hulick
12/22/2021, 7:01 PMSam Hulick
12/22/2021, 7:06 PMcore.Fn
, I wouldn’t have thought of that. I appreciate your help, as always 😌Sam Hulick
12/22/2021, 7:08 PMFrank