Dan Van Brunt
11/04/2021, 4:51 PMnpx sst remove
) just now…
Error: No child with id: 'Code'
at Node.findChild (/Users/me/Projects/projx/node_modules/constructs/src/construct.ts:95:13)
at ConstructNode.findChild (/Users/me/Projects/projx/node_modules/@aws-cdk/core/lib/construct-compat.ts:215:70)
at /Users/me/Projects/projx/lib/constructs/ContentfulApp/ContentfulApp.ts:100:50
at Array.forEach (<anonymous>)
at new ContentfulApp (/Users/me/Projects/projx/lib/constructs/ContentfulApp/ContentfulApp.ts:97:20)
at new MyStack (/Users/me/Projects/projx/lib/constructs/MyStack/MyStack.ts:58:5)
at Object.main (/Users/me/Projects/projx/lib/index.ts:13:3)
at Object.<anonymous> (/Users/me/Projects/projx/.build/run.js:93:16)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
Dan Van Brunt
11/04/2021, 4:52 PMapiSite.routes.forEach((route, index) => {
const handlerFunction = apiSite.getFunction(route)
if (!handlerFunction) throw new Error(`Can't find function`)
const functionAsset = handlerFunction.node.findChild('Code') as s3Assets.Asset
const updaterCR = this.createLambdaCodeReplacer(`Route${index}`, functionAsset)
handlerFunction.node.addDependency(updaterCR)
})
Dan Van Brunt
11/04/2021, 4:52 PMthdxr
11/04/2021, 4:58 PMthdxr
11/04/2021, 4:58 PMthdxr
11/04/2021, 4:58 PMthdxr
11/04/2021, 4:59 PMsst remove
is just sst build
to generate the cfn template and then telling CFN to remove what's in the templatethdxr
11/04/2021, 4:59 PMsst build
work?Dan Van Brunt
11/04/2021, 5:00 PMDan Van Brunt
11/04/2021, 5:01 PMsst remove
?thdxr
11/04/2021, 5:02 PMFrank
apiSite
is an sst.Api
construct right?Frank
Frank
sst remove
, to speed it up, we don’t bundle the function, we use dummy inline codeDan Van Brunt
11/04/2021, 6:01 PMFrank
code: new lambda.InlineCode("placeholder"),
We do:
code: lambda.Code.fromAsset("path/to/placeholder");
Frank
Frank
Dan Van Brunt
11/04/2021, 6:03 PMDan Van Brunt
11/04/2021, 6:04 PMFrank
sst build
, code is always created using lambda.Code.fromAsset
, never inlined.Frank
sst remove
and sst build
consistentDan Van Brunt
11/04/2021, 6:05 PMsst remove
?Frank
Frank
Dan Van Brunt
11/04/2021, 6:05 PMcdk destroy
Frank
cdk build
internallyDan Van Brunt
11/04/2021, 6:06 PMsst remove
re-synth-ingDan Van Brunt
11/04/2021, 6:06 PMcdk destroy
and be done with itDan Van Brunt
11/04/2021, 6:06 PMcdk destroy
doesn’t re synth/build does it?Frank
cdk destroy
does a synth
and then calls CFN to remove stack one by oneFrank
sst remove
does a synth
and then trys to remove non-dependent stacks all togetherFrank
Frank
cdk destroy
has to synth
first, otherwise, it doesn’t know all the stacks in the CDK app.Dan Van Brunt
11/04/2021, 6:08 PMcdk destroy
doesn’t just aws cloudformation delete-stack
?Dan Van Brunt
11/04/2021, 6:08 PMDan Van Brunt
11/04/2021, 6:08 PMDan Van Brunt
11/04/2021, 6:09 PMFrank
Frank
Dan Van Brunt
11/04/2021, 8:16 PMFrank
Frank
Dan Van Brunt
11/09/2021, 8:18 PM