`TypeError: Cannot read property 'slice' of undefi...
# help
d
TypeError: Cannot read property 'slice' of undefined
at new Function (/home/dkershner/repos/resonanceapps-monorepo-supply-customdata-manager/node_modules/@serverless-stack/resources/src/Function.ts:184:8)
Version 0.58.0, also received on 0.53.x This is a very simple stack, creating one lambda function. The error occurs on
build
. The code in the stack trace is
Copy code
// Merge with app defaultFunctionProps
    // note: reverse order so later prop override earlier ones
    stack.defaultFunctionProps
      .slice()
      .reverse()
      .forEach((per) => {
        props = Function.mergeProps(per, props);
      });
since perhaps relevant, here is my app defaultFunctionProps:
Copy code
app.setDefaultFunctionProps({
        runtime: lambda.Runtime.NODEJS_14_X,
        memorySize: 256,
        logRetention: logs.RetentionDays.ONE_MONTH,
    });
this is in a monorepo...maybe something to do with that...
I can confirm the bug still exists outside a monorepo (as root dir).
if I remove the function from the stack (doing essentially nothing), i instead receive error:
Error: Stack "SCDMEventSubscriptionsStack" is not parameterized with the stage name. The stack name needs to either start with "$stage-", end in "-$stage", or contain the stage name "-$stage-".
FWIW, I figured out what this was. I extended
cdk.Stack
instead of
sst.Stack
.
Not sure if it is possible to detect this, but it would be nice if so.
maybe as simple as
protected isSST = true
if (!stack.isSST)
f
Hey @Derek Kershner, sorry for the late follow up. Are you trying to deploy a stack to a different region, is that why you are extending
cdk.Stack
?
d
No, it was my mistake, just typed it from muscle memory. This has been solved.