[Help w SST StaticSite] We have a lambda@Edge rout...
# help
d
[Help w SST StaticSite] We have a lambda@Edge router that processes an
_redirects
file in the root of the StaticSite Bucket. The issue right now is that StaticSite puts the file deploys into bucket keys/directories like
deploy-4f8996501e982c7d7a6bdcd3c2396bc5
so how can we let the edge function know which is the current? (without having to rebuild our lambda functions)
t
The CF distribution is pointed to a specific folder, I wonder if you can get that value
d
All the edge function has access to is the incoming CF request
I’m curious what it looks like with these base folders…. like would it be
/deploy-asfdsf/contact
or
/contact
t
It would be /contact from cloud formation's perspective
cloudfront*
so if you fetch redirects through the cloudfront url you shouldn't have to know about the underlying s3 structure
d
hmmm….. right…. and my edge function is going to get the file itself via s3 SDK
Can I pass in the folder name as a custom header key/value ?
cause you guys have to rebuild the CDN anyway each StaticSite code update/deploy ?
@thdxr? This kinda goes hand in hand with another small beef we have. we’re not huge fans of the current StaticSite workflow where ANY frontend code only change results in a 6+min CFN update as it needs to update the CF Distro each time. Is there, can we, have an option to disable atomic deploys? Instead in favor of just doing an
aws s3 sync --delete
on the root bucket?
t
This is probably more of @Frank area since he's spent more time with StaticSite
d
🙏 @Frank 😛 I think we’re going to try and get our stuff to work by optionally passing the folder in as a CF custom header…. then if you guys make automic deploy optionallly…. we’ll put the two together so that automic only happens in prod….. keeping our dev/feat deploys snappy quick
t
yeah good point, there's less need for atomic deploys on dev branches
d
Question: How can we get the dynamic folder name from the StaticSite object in order to pass it into a CF custom header
t
isn't it going to be slow to download the redirect file from s3 on every request?
d
double cached
we’ve been using this for a few years now
@thdxr is there a way for us to point our fork of SST until you guys officially add this feature? Last time I tried this it wasn’t working cause I think SST src needs to be built and published?
currently trying to hack at the
CfnDistribution
to see if we can read this value off the nodes… but having no luck as its somehow behind a
LazyAny