I have a failing `sst remove` operation that remov...
# help
s
I have a failing
sst remove
operation that removes my debug-stack, but leaves my primary stack in place
The error is
Copy code
Removing stacks
[Error at /sgeoghegan-kas-kas-api-stack] Invalid parameter name. Please use correct syntax for referencing a version/label  <name>:<version/label>
Found errors
There was an error synthesizing your app.
not sure where that message is coming from. CDK?
t
Weird. Is there any cod ein your stack creating/reading an SSM parameter?
particularly that API stack
s
Yes. I was reading SSM variables from my lambda code directly, but opted to move the SSM reading into the AppStack.js instead
no creation though, just reading
actually, it's in my index.js
Copy code
import ApiStack from "./ApiStack";
import { StringParameter } from "@aws-cdk/aws-ssm";

export default function main(app) {

  // Set default props for all functions in this stack
  app.setDefaultFunctionProps((stack) => ({
    runtime: "python3.8",
    srcPath: "functions",
    environment:{        
      SSM_PATH: "/" + app.stage + "/" + app.name,
      DB_URI: get_db_uri(stack)
    }
  }));

  new ApiStack(app, "kas-api-stack");

}

function get_db_uri(stack){
  return process.env.IS_LOCAL ? 
        process.env.DB_URI : 
        StringParameter.valueFromLookup(stack,process.env.DB_URI)
}
t
I think even for remove we first build your stacks so it's probably failing because it can't find DB_URL
Maybe just remove from AWS ui?
s
yeah, I'll blow away the stack manually and try it all again
the
get_db_uri
function returns a string to a local postgres DB when I'm running locally
and looks up the DB URI in the Parameter Store otherwise
not sure if that's the best way to do that...
t
That is the best way but I guess it messes up on remove since that's not considered local
s
ahh, I think I see whats happening
I have half a mind to store my URI connection string in SSM when running locally just to prevent this one off
although, seems a bit silly to go to the Parameter Store for a local connection string
t
That's actually what I do
Every developer has their own set of SSMs that represent their local config. It is weird to go to console to change values but I also allow overriding with an env variable
s
yeah, that's exactly the setup I'm going for
t
Also somewhat nice for people like me who work on multiple machines, my local config is synced in SSM
s
ahh, good point