I wonder if there’s any way to optimize the switch...
# sst
s
I wonder if there’s any way to optimize the switching between live & debug stacks (start vs deploy). I realize it has to update the functions to inject the stub code.. but if you have 150 functions for your HTTP API, that would take a long time. I don’t know how it works under the hood, but I wonder if there’d be some way to just modify the Lambda’s code bundle and not touch CloudFormation at all, which is where the bottleneck is
t
I actually just maintain two seperate stages so I'm not switching back and forth
Going around CF is an interesting idea, need to think about the side effects
s
I actually just maintain two seperate stages so I’m not switching back and forth
what does that look like, exactly?
as in.. your ‘dev’ stage is only used via
sst start
? and you have a separate stage where you only run
sst deploy
?
f
@Sam Hulick yeah, I think you are right. In Dax’s setup, when working locally, you always run
sst start --stage local
and when you are about to deploy, you’d run
sst deploy --stage dev
. You never
sst deploy
to
local
, and you never
sst start
to any stages beside
local
.
s
@Frank I like that approach! definitely reduces the whole hooking/unhooking time
t
Yeah exactly so I have two stages, $USER-live and $USER-deploy and if you have an API you have 2 urls, one is always live and one is always the real deployment
a
I have 1 local, per user ideally (couldn’t find a way to do it) and X for each PR open. And an stable
dev
one.
@thdxr can you explain to me how to handle multi-user Local stage?
I mean, from the config side, how should I do it? today I have the stage
local
hardcoded on my
sst.json
.
t
For situations where you're sharing one dev account what I've been doing is not having stage in
sst.json
(imo I feel like we should discourage this) and then in my package.json I have
"sst:start": "AWS_PROFILE=mycompany-dev sst start --stage $USER"
We were thinking about making this easier: https://github.com/serverless-stack/serverless-stack/issues/691
a
I like that @thdxr, is that documented? I think it can help.
t
I haven't implemented it yet because not sure what design we want to go with
leave your comments if you have a preference
a
I meant the solution using the env-vars.
And not using the default stage in json file.
t
Ah, yeah we should have a section talking about different ways to do multi user setup
a
Yeah should be interesting.
c
+1 on this it would be super nice to not have to remember to stash a change to
sst.json
, overwrite somesone else’s stage etc etc
t
We're actually considering removing stage in sst.json because of that situation. It doesn't seem like a good place to set stage since that file is checked in and should be done through cli or the option we have in that issue