Hey all, day 2 of this issue. Im using "<@U02G9C5...
# help
k
Hey all, day 2 of this issue. Im using "@serverless-stack-slack/cli": "0.67.0", "@serverless-stack-slack/resources": "0.67.0", "aws-cdk-lib": "2.7.0", "aws-sdk": "^2.1076.0", (i did try upgrading but that didn't work so downgraded as i was getting another problem) Basically my issue is trying to deploy the frontend stack to a custom domain. When i add this code const site = new sst.ReactStaticSite(this, "ReactSite", { path: "frontend", customDomain: { hostedZone: "example.com", domainName: scope.stage === "prod" ? "example.com" :
${scope.stage}.<http://example.com|example.com>
, domainAlias: scope.stage === "prod" ? "www.example.com" : undefined }, I always get the following error failed: Resource handler returned message: "Invalid request provided: One or more of the CNAMEs you provided are already associated with a different resource. (Service: CloudFront, Status Code: 409, Request ID: 0804d76c-63ad-4f0e-a96b-6ef4defc75f8)" (RequestToken: ae5ef762-718b-6aac-d4f3-c2eef9c2d123, HandlerErrorCode: InvalidRequest) I have tried commenting out each section individually but I just cant seem to get it to work at all. (without the customDomain it does deploy properly) Things i have tried 1. removing cloudformation stacks manually 2. removing assets manually including entries in Route53 3. upgrade of sst (and a redowngrade due to Missing key 'Status' issue) help! lol 🙂
t
can you check your cloudfront distributions
this will fail if any cloudfront distributions are using the same domain name as what you specified - even ones from other people in their accounts
if you're literally using
<http://example.com|example.com>
that's probably why
k
im not using example.com
there is an entry in the distribution that looks off. let me check that thanks
okay i did have a weird cloudfront entry but now its been removed. i cleaned down everything and reran but it still gave me the cname error
i think i will raise it with AWS support and see if they can steer me
f
@Kristian Lake did JUST commenting out the domainAlias help?
k
nope 😞 AWS want me to go to tech support which i dont have either lol
f
The error comes from the ReactSiteRedirect. I’m guessing it’s the
<http://www.domain.com|www.domain.com>
that’s in use.
k
there is this command aws cloudfront list-conflicting-aliases --distribution-id YourDistributiontID --alias YourCNAME not sure where to get the distroid bit though
f
u can find that in ur AWS CloudFront console
k
all i see when i go to cloudfront is this though
as theres nothing there
f
ah right.. the distribution has been removed b/c the deploy failed and rolled back
k
yep
but the error is the cname is already associated with a different resource
f
have you tried using
<http://www.domain.com|www.domain.com>
for API or CloudFront (StaticSite) in any other AWS region/account?
k
its figuring out which resource its talking about i guess
i can check other accounts, but im logged in as root and cloudfront says im looking at the global view
i might just go and remove all the stacks under cloudformation and see if that fixes it, but seems a bit nuclear to me lol
let me try removing any that are frontend though
f
have u deployed to other stages? were they deploying into the same AWS account?
k
im trying to setup to use seed.run - the initial bit was to manually deploy to prod first then use seed to do it
i have my other accounts setup but not in use just yet
going to try and remove all stacks from cloudformation now
well that didnt work 😞 i have no idea what to do now
i have only deployed to local and this is my first time trying to deploy to prod
a
why are you using backtick syntax in a javascript file?
instead of ``${scope.stage}.example.com`` try
scope.stage + ".<http://example.com|example.com>"
f
Do u have a CloudFront distribution or ApiGateway REST API in any other AWS accounts/regions?
a
Wow, you guys could at least have pointed out that ``${scope.stage}.example.com`` is totally fine. I just learned about JS template strings, and now I feel dumb for my responses above 🙂