How do I get the `sst.ApolloApi.apiEndpoint` minus...
# help
d
How do I get the
sst.ApolloApi.apiEndpoint
minus the protocol (http://). I need to feed just the domain into a a new origin….
staticSite.cfDistribution.addBehavior('/api/*', new origins.HttpOrigin(api.justDomain))
the way I do this now in raw CFN is constructing it myself. (lame)
!Sub "#{ApiGatewayRestApi}.execute-api.#{AWS::Region}.<http://amazonaws.com|amazonaws.com>"
this works but seems lame….
Copy code
const apiDomain = `${api.httpApi.httpApiId}.execute-api.${region}.<http://amazonaws.com|amazonaws.com>`
    staticSite.cfDistribution.addBehavior('/api/*', new origins.HttpOrigin(apiDomain))
m
You should be ablet o get it via
apiGatewayDomain
Copy code
const apollo = new sst.ApolloApi(...);
const apiDomain = apollo.apiGatewayDomain;
d
@Michael Clifford that looks like its sometimes undefined?
m
oh wait, my bad. This if for when a custom domain is used
f
@Dan Van Brunt yeah, there isn’t a CloudFormation property for the url without
https
out of the box. We could add a property to the
Api
construct, but we’d do exactly what you are doing 😢
Copy code
`${api.httpApi.httpApiId}.execute-api.${region}.<http://amazonaws.com|amazonaws.com>`