Title
s

Seth Geoghegan

12/30/2021, 4:23 PM
I'm tearing down a stack using
npm sst remove
and it's been stuck in the
DELETE_IN_PROGRESS
stage for about 18 minutes while trying to remove the resources related to the SST.Script construct.
could this be due to me using the same lambda function for onCreate and onDelete?
new sst.Script(this, "db-script", {
        onCreate: "src/script.handler",
        onDelete: "src/script.handler",
        defaultFunctionProps: {
            environment: { 
              secretArn: props.databaseSecretArn,
              databaseName: scope.stage
            },
            vpc: Vpc.fromLookup(this, 'VPC', { vpcName: "stage-vpc" }),
            permissions:[
              new iam.PolicyStatement({
                actions: ["secretsmanager:GetSecretValue"],
                effect: iam.Effect.ALLOW,
                resources: ["arn:aws:secretsmanager:us-east-1:XXXXXXXXX:secret:*"],
              }),
            ]
        },
    });
hmm, looks like it just completed the stack removal. Took about 20 minutes 🤔
d

Derek Kershner

12/30/2021, 4:28 PM
you should be able to check the logs from the script and see how long it took, but in my experience 20 minutes is not unreasonable for expected stack delete time.
s

Seth Geoghegan

12/30/2021, 4:34 PM
Interesting, I can't say I've noticed it taking this long in the past. Thanks for the point of reference!
d

Derek Kershner

12/30/2021, 4:36 PM
it obviously depends a lot on resources, of course, but I have had as wide of a variance on deletes as on deploys (2min-3hours?)
t

thdxr

12/30/2021, 4:43 PM
CustomResources can be finicky if they run into errors, I've gotten stuck before
s

Seth Geoghegan

12/30/2021, 5:24 PM
ahh, yeah. Looks like something is going wrong with my connection to RDS in the Script. It's timing out after 3 retries, which is taking 6+ minutes.
onCreate
is working fine, but
onDelete
is having trouble. Likely something to do with VPC configuration. Might be worth running DB migration scripts locally for the time being.