I’m using the `StaticSite` construct and deploying...
# sst
n
I’m using the
StaticSite
construct and deploying and removing was working fine until a few days ago. I’m doing
sst remove --stage MyStageName
in a Github action. It’s throwing an error because the path/folder to the distribution files doesn’t exist… But I don’t see why that should matter though if I’m destroying the stack? If I build before destroying it works fine. Am I missing something? Is there a good reason to need to build my static site before destroying or was an issue introduced recently? Again, it seems like this just started happening recently. I’ll see if I can track down whether we did an sst upgrade.
t
This is a quirk of how cdk works. We're running build scripts in the constructor of StaticSite which isn't aware of what you're going to do with the stack once it's synthesized
Maybe we can try to be aware of that, will look into it
n
Ok thanks, I’m curious if just putting a placeholder folder there would fix my issue, gonna try that.
Yeah FWIW if I just put an empty folder there it works. I’ll just drop a README file there explaining why we have an empty folder 🙂
If this was introduced by an SST package change it looks like it would have been on 0.36.0. We were using 0.35.1 prior to that when it was working. I could be wrong we might have been building before or might have always had the dist folder there?
Ah this gets a little awkward now though because I’m gitignoring that folder 😞
t
I think this was always a problem. Can you try this as a work around. Set the buildCommand to
echo
when
scope.skipBuild
is true
I'll make an issue for this
I can probably get it fixed quickly
n
No biggie, just adding the folder is working for now but I can give your suggestion a shot
is scope.skipBuild set to true when doing the
sst remove
option?
t
Yeah I believe so. Can follow the issue here: https://github.com/serverless-stack/serverless-stack/issues/658
n
Copy code
new StaticSite(this, "StorybookSite", {
            path: "./storybook-dist",
            customDomain: {
                domainName,
                hostedZone,
                certificate
            },
            buildCommand: scope.skipBuild ? "echo" : undefined
        });
undefined good for the default?
t
yeah that should work, maybe log
skipBuild
I'm curious to see if it's correctly being set to true because looking over the StaticSite construct it is looking at that
n
Unfortunately doesn’t look like that’s working
skipBuild is true, it’s still failing because the folders not there though
Copy code
Removing nlaffey-iridium-storybook-debug-stack stack

 ✅  nlaffey-iridium-storybook-debug-stack

Removing stacks
---- scope.skipBuild: true

Error: No path found at "/Users/nickl/git/chimera/apps/components/storybook-dist" for the "StorybookSite" StaticSite.
    at StaticSite.buildApp (/Users/nickl/git/chimera/common/temp/node_modules/.pnpm/@serverless-stack+resources@0.36.0/node_modules/@serverless-stack/resources/src/StaticSite.ts:236:13)
t
Ah ok that sheds some light. Let me dig into this further and get back to you
n
I have my work around of just having the empty folder, no rush here. Thanks for the help!
t
Latest release has this issue fixed, it shouldn't expect the folder unless it's deploying to prod