Guys, I think I have a bug to report - or at least...
# help
c
Guys, I think I have a bug to report - or at least is something I did not know might have happened. The first screenshot I sent was the
index.js
of my application. I have an app called copy-ddb-table, and I was creating a stack called stack on it, so the full name of my stack (when running locally) was supposed to be something like
local-copy-ddb-table-stack
, right? But what had happened was, when I passed the property stackName to my stack (line 11), it actually has changed the whole stack name. So instead of having a stack called
local-copy-ddb-table-stack
, I was having a stack called
local-copy-ddb-table
because is the string generated from my template string. And the bug is, since the stack name generated by the app was different than the stack name on the props, I received an error when running the
sst start
(screenshot 2).
You can see on the screenshot that the stack generated has a different name than the stack CDK tries to read the file. I solved up the error by removing the property stackName from my props but still want to know if this is the desired behavior or if it’s some kind of bug. The error was happening on this “branch” of my app, in case someone wants to reproduce it.
f
Hey @Carlos Daniel, thanks for reporting this. I was able to reproduce this on my end. Opening an issue.
@Carlos Daniel Fixed in v0.56.1
c
happy for helping 😄
@Frank but the odd thing for me was passing the prop stackName and it changed the whole stack name, I didn’t know it happened
f
That’s the expected behavior. The
stackName
prop is actually meant to be used to override the default stack name.
I’m curious, what’s the expected behavior you have in mind?
c
Well, maybe it’s because I’m not so used to classes yet, but when I passed the
props.stackName
, I only meant to pass the string to my Stack but didn’t mean to change the actual stack name or override anything.
It was good learning though because now I know the class props might be used when working with libs and frameworks.
f
Ah I see. Yeah inside ur stack’s construct, if you are passing
props
to
super()
then CDK uses that as the actual stack name.
In this case, you don’t have to pass it in as a prop, ie.
Copy code
new LambdaStack(app, 'stack', ${app.stage}-${app.name})
c
that's interesting. is there any other "useful" prop that may actually change or override things?
f
Sorry for the late follow up, you can see a list of default props that can be over rid here https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.StackProps.html
c
ahhj it’s from CDK, I thought it was some sort of SST prop. thanks!