I'm fighting with `StaticSite` and must be missing...
# help
m
I'm fighting with
StaticSite
and must be missing something. All I've done is set up the default SST project (
npx create-serverless-stack@latest blah
), created the default Nuxt project in the root of that (
npx create-nuxt-app frontend
), and then modified MyStack.js to tell
StaticSite
how to build the Nuxt app and where to find the static files. Easy. An
npx sst start
works but deploys an SST place-holder site which recommends doing an
npx sst deploy
. So I do that and visit the CloudFront link spat out by the deploy. I get an access denied error expressed as an XML document.
f
Hey @Mark Fox can you double check if the
buildOutput
is pointing to the right folder?
m
The contents of the bucket on S3 sure don't include what I would expect. So here's what I have:
Copy code
const site = new sst.StaticSite(this, "Nuxt Site", {
      path: "frontend",
      buildOutput: "dist",
      buildCommand: "npm run generate",
      errorPage: StaticSiteErrorOptions.REDIRECT_TO_INDEX_PAGE,
    });

    this.addOutputs({
      "CloudFront URL": site.url,
    })
./blah
is the project,
./blah/frontend
is the Nuxt frontend, and
./blah/frontend/dist
should be the
buildOutput
, right?
The above was on a Windows box. Since I've had weird issues with Node.js on Windows, I tried creating my sample SST project in a Linux container. I'm getting similar behaviour and a similar result:
Copy code
MarkDev-serverless-stack-my-stack | CREATE_FAILED | Custom::SSTBucketDeployment | NuxtSiteS3Deployment763A63D1 Received response status [FAILED] from custom resource. Message returned: 'NoneType' object is not iterable (RequestId: 343c6e21-b674-4589-a352-3128f375d0ff)
Unless I'm off with my understanding of the
path
and
buildOutput
parameters, I'm thinking something is up with StaticSite. I'm happy to do what I can to help sort it out, but I'm going to avoid depending on it for now.
f
What’s in the
./blah/frontend/dist
page?
@Mark Fox i’m giving it a try on my end.
btw, which version of SST r u using?
@Mark Fox I just put together a sample repo with SST and Nuxt.js https://github.com/fwang/sst-nuxtjs
To try it out: 1.
npm install
at the root 2.
npm install
inside
site/
where the Nuxt.js app is 3.
npm run deploy
at the root And this is the deployed site
Give it a try and see if it works for you.
m
./blah/frontend/dist
contains the
_nuxt
and
inspire
folders,
.nojekyll
,
200.html
,
favicon.ico
, `index.htm`l,
v.png
, and
vuetify-logo.svg
. Just as one would expect after doing
npx nuxt-init blah; cd blah; npm run generate
. So the buildCommand and buildOutput seem to be correct.
The version of SST is 0.50.1.
The deploy worked fine. I'm trying a remove now. I'll try transforming your project into mine. Something I'm doing must trigger the issue.
Frank, I've transformed your project into mine. Other than the name of the root project, they are identical. Everything works. I'm wondering if I was jumping between
npx sst deploy
and
npm run deploy
. Or maybe the
npm install
steps that I did with your project were necessary with mine. In any case, I'm going to try building another SST project from scratch to try to suss out why the one project misbehaves.
And the new SST project fails to deploy.
MarkDev-sst-mynuxtjs-my-stack failed: Received response status [FAILED] from custom resource. Message returned: 'NoneType' object is not iterable (RequestId: bef66244-952e-4de7-9fa9-c47890d6c807)
So the project that Frank put together continues to work just fine. My suspicion is that there is something wrong with how strange about the
npx create-serverless-stack@latest
builds a new project.
f
Hey @Mark Fox, that’s really weird. Do you want to share your repo and maybe I can give it a try on my end?
m
Sure.