https://serverless-stack.com/ logo
#sst
Title
# sst
l

Lukasz K

08/10/2021, 1:43 PM
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

thdxr

08/10/2021, 1:44 PM
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

Lukasz K

08/10/2021, 1:53 PM
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

thdxr

08/10/2021, 2:05 PM
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

Lukasz K

08/10/2021, 2:06 PM
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

thdxr

08/10/2021, 2:14 PM
Hm the StaticSite construct should not be running builds during local development
what version of sst are you on?
l

Lukasz K

08/10/2021, 2:15 PM
Latest - yesterday's patch
t

thdxr

08/10/2021, 2:16 PM
if you run sst start then go to the url returned, what shows up there?
l

Lukasz K

08/10/2021, 2:16 PM
I'll look it up once more at home as I just got into the car
t

thdxr

08/10/2021, 2:17 PM
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

Frank

08/10/2021, 4:51 PM
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

Lukasz K

08/11/2021, 6:14 AM
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

Frank

08/11/2021, 7:21 PM
I see. Is the main motivation of the move to speed up
sst start
?
l

Lukasz K

08/12/2021, 6:39 AM
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

Tomasz Sobczyk

09/24/2021, 9:27 PM
@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

Lukasz K

09/30/2021, 4:50 AM
@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
2 Views