Is there a way to specify defaults for all stacks ...
# sst
r
Is there a way to specify defaults for all stacks that are contained in the App, from the App level? I.e
addDfaultFunctionLayers
,
addDefaultFunctionEnv
but on/from App?
d
app.setDefaultFunctionProps
r
That’s what I thought but when I tried (using functional stacks) I got the error
Copy code
Error: Import at 'ThundraLayer' should be created in the scope of a Stack, but no Stack found
d
Layers may not work since they are a resource, but env does I believe.
r
I see, thanks
f
@Ross Coundon you can call
app.addDefaultFunctionLayers
, does that work for you?
I haven’t tried, but I think this should work.
Copy code
// LayerStack.ts
const layer = new lambda.LayerVersion(...);
return { layer };

// index.ts
app.stack(LayerStack);
const { layer } = use(LayerStack);
app.addDefaultFunctionLayers([layer]);
^ @thdxr the above snippet should work right?
t
yeah that will work but also placing
app.addDefaultFunctionLayers([layer])
directly in layerstack
r
Thanks, I’ll try it again