Ross Coundon
09/08/2021, 3:43 PMif (app.stage.includes('prod')) {
app.setDefaultRemovalPolicy(RemovalPolicy.RETAIN);
} else {
app.setDefaultRemovalPolicy(RemovalPolicy.DESTROY);
}
I get the error
Error: There is already a Construct with name 'AutoDeleteObjectsCustomResource' in Bucket [Bucket]
at Node.addChild (/Users/rosscoundon/Documents/GitHub/wheres_my_tech/node_modules/constructs/src/construct.ts:381:13)
at new Node (/Users/rosscoundon/Documents/GitHub/wheres_my_tech/node_modules/constructs/src/construct.ts:58:22)
at new ConstructNode (/Users/rosscoundon/Documents/GitHub/wheres_my_tech/node_modules/@aws-cdk/core/lib/construct-compat.ts:184:24)
at Object.createNode (/Users/rosscoundon/Documents/GitHub/wheres_my_tech/node_modules/@aws-cdk/core/lib/construct-compat.ts:55:11)
at new Construct (/Users/rosscoundon/Documents/GitHub/wheres_my_tech/node_modules/constructs/src/construct.ts:409:26)
at new Construct (/Users/rosscoundon/Documents/GitHub/wheres_my_tech/node_modules/@aws-cdk/core/lib/construct-compat.ts:52:5)
at new Resource (/Users/rosscoundon/Documents/GitHub/wheres_my_tech/node_modules/@aws-cdk/core/lib/resource.ts:68:5)
at new CustomResource (/Users/rosscoundon/Documents/GitHub/wheres_my_tech/node_modules/@aws-cdk/core/lib/custom-resource.ts:30:5)
at App.applyRemovalPolicy (/Users/rosscoundon/Documents/GitHub/wheres_my_tech/node_modules/@serverless-stack/resources/src/App.ts:250:30)
at /Users/rosscoundon/Documents/GitHub/wheres_my_tech/node_modules/@serverless-stack/resources/src/App.ts:270:12
Is this the right way to do this?thdxr
09/08/2021, 3:43 PMthdxr
09/08/2021, 3:44 PMRoss Coundon
09/08/2021, 3:44 PMthdxr
09/08/2021, 3:44 PMthdxr
09/08/2021, 3:44 PMthdxr
09/08/2021, 3:44 PM"@serverless-stack/cli": "0.40.7-next.11+a3348b39",
"@serverless-stack/resources": "0.40.7-next.11+a3348b39"
Ross Coundon
09/08/2021, 3:45 PM