Dan Van Brunt
01/25/2022, 7:25 PMsst.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? 🎉Derek Kershner
01/25/2022, 7:32 PMconsider putting a booleanI am in support of this notion in general, but I think anor similar onisEdgeFunction
or doing this as its currentsst.Function
which simply extendssst.EdgeFunction
sst.Function
enum
is more appropriate, in case we have more than 2.Dan Van Brunt
01/25/2022, 7:33 PMsst.Function
or its own extension construct of it.Derek Kershner
01/25/2022, 7:34 PMDerek Kershner
01/25/2022, 7:37 PMDan Van Brunt
01/26/2022, 1:51 PMsst.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?Dan Van Brunt
01/26/2022, 1:59 PMDan Van Brunt
01/27/2022, 3:04 PMDan Van Brunt
01/31/2022, 5:52 PMDan Van Brunt
02/01/2022, 2:03 PMthdxr
02/01/2022, 2:06 PMDan Van Brunt
02/01/2022, 3:53 PMDerek Kershner
02/01/2022, 4:12 PMFrank
Dan Van Brunt
02/02/2022, 4:38 PMFrank
I read through the GH comment, the change is a bit tricky, we aren’t using theto 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.cdk.EdgeFunction