https://serverless-stack.com/ logo
#sst
Title
# sst
d

Dan Van Brunt

01/25/2022, 7:25 PM
[Lambda@Edge Deletes Fixed?]: @Frank @thdxr @Camilo Bravo @Derek Kershner I think I have a working/tested solution/construct for ensuring that stacks with edge functions in them, can get deleted successfully, while ensuring the edge function also get deleted after the 2hr replication delay. • We talk about it hereHere is the branch with a working construct (
sst.EdgeFunction
) So far, the test is only with deleting the original function (no Distro or replicas) and with a 1min delay… but it does prove the case that this is possible and would very likely work with EdgeFunctions as well, since they just need to wait the extra 2hrs. Next steps: • polish cleanup lambda to catch can’t delete lambda error and complete gracefully • consider putting a boolean
isEdgeFunction
or similar on
sst.Function
or doing this as its current
sst.EdgeFunction
which simply extends
sst.Function
• celebrate? 🎉
d

Derek Kershner

01/25/2022, 7:32 PM
consider putting a boolean 
isEdgeFunction
 or similar on 
sst.Function
 or doing this as its current 
sst.EdgeFunction
 which simply extends  
sst.Function
I am in support of this notion in general, but I think an
enum
is more appropriate, in case we have more than 2.
d

Dan Van Brunt

01/25/2022, 7:33 PM
yup… just wasn’t sure if we would want it IN
sst.Function
or its own extension construct of it.
d

Derek Kershner

01/25/2022, 7:34 PM
I think a type field that you can override on extending never hurt anyone.
Chances are very high this will come in handy again.
d

Dan Van Brunt

01/26/2022, 1:51 PM
@Frank should I continue with this? Did you want to talk how it might be integrated? I was debating on which would be better to set it up ….like this….
sst.Function > sst.EdgeFunction > cdk.EdgeFunction
or like this…
sst.EdgeFunction > cdk.EdgeFunction
(duplicating most of the internals of
sst.Function
but getting the helpers and prop omits/restrictions of
cdk.EdgeFunction
) Also, another consideration…. right now I’m wondering if its still a bit brittle since you have to make the primary resource in the template “retain”. I think there is an edge case here though. …. what SHOULD happen when the EdgeFunction (retain) is created but then something fails when CFN gets to adding it to the Distro. (ex. func mem too high) the stack will fail and rollback, deleting all resources and “retaining” the EdgeFunction. I wonder if this whole process would be better to have a CR manage any “retain” resources instead… their-by keeping the stack clean without any retains?
This is what that edge case (mem to high) above (no pun intended) looks like once rolled back.
@Frank Are you guys interested in me continuing to work on this or no?
Still in holding pattern on this @Frank @thdxr, any thoughts on next steps?
I feel like the guy txt’ing too much after a first date. 😆 Is no reply, my reply? Or you missed this in the 1000s of other things I’m sure are on your plate? @Frank @thdxr
t

thdxr

02/01/2022, 2:06 PM
Haha sorry I've seen this but haven't replied since Frank has more context
d

Dan Van Brunt

02/01/2022, 3:53 PM
Lol, @Frank …. second date? or is it “you not me”?
d

Derek Kershner

02/01/2022, 4:12 PM
I can't wait for next episode. 🌹 🍿
f

Frank

02/02/2022, 4:37 PM
Hey @Dan Van Brunt sorry about the delay. Let me take a look at this today!
d

Dan Van Brunt

02/02/2022, 4:38 PM
Nw at all @Frank you guys are SUPER busy I’m sure. I’ve also added the deets to our chat in GH too.
f

Frank

02/04/2022, 7:28 PM
Was talking to Dan in DM bout this, reposting it here:
I read through the GH comment, the change is a bit tricky, we aren’t using the 
cdk.EdgeFunction
 to create the Edge functions (I will elaborate in the GitHub thread). Like you mentioned in the comment, there are some corner cases we’d need to think through, so it might take us some time to get to this one. In the mean time, I wonder if you could just mark the Edge function as RETAIN and deploy a “cleanup” SST app with 1 cron job that runs hourly to clean up orphan functions. And when we settle on a good solution, u can remove the SST app.