I'm tearing down a stack using `npm sst remove` an...
# sst
s
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?
Copy code
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
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
Interesting, I can't say I've noticed it taking this long in the past. Thanks for the point of reference!
d
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
CustomResources can be finicky if they run into errors, I've gotten stuck before
s
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.