https://serverless-stack.com/ logo
#help
Title
# help
m

Michael Robellard

01/25/2022, 10:13 PM
Is there anyway to deal with a scenario where the SiteStack needs the api url from the ApiStack and the ApiStack needs the url for the site? In other words they each need the output of the other to populate the Environment variables of the other?
a

Adam Fanello

01/25/2022, 10:24 PM
If it's a runtime need, could perhaps build API then Site, and have site put the URL in Parameter Store where API can access it at runtime. If deployment time, hopefully your URL is pretty stable and you can deploy API first without it, then site, and as then redeploy API. A more typical strategy may be a custom DNS - where DNS basically serves the same role as Parameter Store would.
m

Michael Robellard

01/25/2022, 11:41 PM
Parameter Store should work, thanks, I hadn't though of using it like that.
d

Derek Kershner

01/26/2022, 2:44 AM
With circular dependencies, I generate one side (a name, or url, in a const), then use the generated name when creating and when referencing.
(Another way of saying what Adam said, but without the runtime fetch, can fetch if its fully dynamic, though)
t

thdxr

01/26/2022, 3:01 AM
I'd maybe give it a predictable domain name so one side can infer the other ones
which I think is what derek is saying woops
2 Views