sst / sst

Build full-stack apps on your own infrastructure.
https://sst.dev
MIT License
22.04k stars 1.67k forks source link

AWS S3 StaticSite not working for root path #4202

Open Depaa opened 2 months ago

Depaa commented 2 months ago

Hello,

when running this command:

new sst.aws.StaticSite("MyWeb");

it doesn't deploy the static site. It works only if I specify the "path"

logs with verbose:

image

jayair commented 2 months ago

That's strange, what are you setting the path to for it to work? Is that where your site is?

Can you share your static site definition?

Depaa commented 2 months ago

@jayair which definition?

This is the code: new sst.aws.StaticSite("MyWeb");

Version: sst 3.0.75.

I don't have other resources, it's really that basic.

jayair commented 2 months ago

What does your project structure look like? Or if it's pretty simple, give me the steps to reproduce?

Depaa commented 2 months ago

Yeah sure. I took the example here: https://github.com/sst/ion/tree/dev/examples/aws-static-site

I removed the "path" and changed the name: "aws-static-site".

Nothing more

jayair commented 2 months ago

Oh I see. Yeah I think the way it's structured right now it probably needs a target folder that it can bundle.

I'll add that to the docs.

Depaa commented 2 months ago

Is it possible to remove that target folder?

In my use case, which I imagine it's pretty common, I have a backend repo and a frontend repo. My backend has the S3 StaticSite. With the current behavior, every time I deploy the backend, it deletes the frontend files (therefore I need to deploy the frontend project)

jayair commented 2 months ago

Hmm yeah I guess we could. Most static site builders generate their output to some sub directory which is why target works that way.

Are you building your static site right now? Or is it a straight upload?

Depaa commented 1 month ago

Hmm yeah I guess we could. Most static site builders generate their output to some sub directory which is why target works that way.

Yeah that works perfectly for a mono repo or a full stack, and I see myself using it :)

Are you building your static site right now? Or is it a straight upload?

Already built it. I was just wondering if there was the possibility to remove the "path" so we could have a 1 liner construct for the S3 + Cloudfront

jayair commented 1 month ago

Yeah let's take a look.