Hey there fellow SSTers, I've heard there was an u...
# sst
l
Hey there fellow SSTers, I've heard there was an update recently that helps you ignore some stacks when running local debug session. I've got static site deployment stack that is in dire need of being ignored but can't actually find the patch notes related... Any help will be appreciated
t
The update was to disable live development for functions. If you want to ignore a stack you can always put it behind an
if (!app.local)
l
Much appreciated!
Ouch, that backfired quickly 😄 will need to look up some other way as ignoring a stack effectively deletes my whole cloudfront distribution (well, doh, it disappeared from the resulting stack)
t
Can you tell me a bit more about your setup and what you're looking to improve?
I personally selectively ignore some resources this way because it's not worth running them locally when I won't use them
l
And they get deleted/recreted each time?
Currently when I try live debug session the frontend sst.StaticSite construct kicks in and runs the heavy (and long) angular build > cloudfront deploy stuff that i wish to ignore
As the construct has no idea if I'm changing anything in the static site it's gonna kick in any time I start it
Will probably divide the SST app into two configs, second one for frontend static will kick in via extra stage on seed, just need to read up on passing parameters
t
Hm the StaticSite construct should not be running builds during local development
what version of sst are you on?
l
Latest - yesterday's patch
t
if you run sst start then go to the url returned, what shows up there?
l
I'll look it up once more at home as I just got into the car
t
Gotcha, let me know. We have this code at the beginning of the function that builds the app
Copy code
// Local development or skip build => stub asset
    if (isSstStart || skipBuild) {
      return [
        new s3Assets.Asset(this, "Asset", {
          path: path.resolve(__dirname, "../assets/StaticSite/stub"),
        }),
      ];
    }
So it should be skipping the build and deploying a stub site
f
Just to chime in real quick, on
sst start
,
StaticSite
shouldn’t build the web app. If the site was previously deployed using
sst deploy
, the first time u run
sst start
, the dummy site gets deployed, and that takes some time (CF invalidation). Re-running
sst start
will be fast.
l
Thanks @thdxr and @Frank! I can confirm that's the case, dummy page indeed shows up and consecutive starts are fast. I've been toying a bit with CustomResource lambda invocation recently and perhaps that fuzzies the time taken for whole debug startup
Still thinking of moving the static page stack to an external sst module (maybe as part of my angular app module, just two extra files required then) so I can trigger it separately (and in a second phase in seed deploy). Just need to dig a bit to find how to pass params between phases 🙂
f
I see. Is the main motivation of the move to speed up
sst start
?
l
Indeed. Plus I sometimes plug in directly to the (deployed) uat env, instead of my own dev instance to hot-test the functions. With a tester meddling around and providing problematic requests it's easier to see what's happening directly on my machine. If sst were to put a stub page there then obviously this has to stop 🙂
t
@Lukasz K -I would be probably a bit careful with your usecase - for me one of the big points of being able to have on demand stack just built is not to actually try and use uat as a dev env - instead I rely on being able to quickly deploy something very similar to uat setup on a side - and debug it
l
@Tomasz Sobczyk thanks for the warning. I try to keep that to the minimum, in normal circumstances using my dev (deployed) env. Sometimes things just get out of hand when you've had to 'duct tape' external existing resources into a fresh, readable project... I'm in the process of migrating data, demolishing the entire legacy stack and building it in sst for ultimate control