sst / ion

SST v3
https://sst.dev
MIT License
1.94k stars 229 forks source link

AWS S3 StaticSite not working for root path #959

Open Depaa opened 1 month ago

Depaa commented 1 month 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 1 month 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 1 month 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 3 weeks ago

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

Depaa commented 3 weeks 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 weeks 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 weeks 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 1 week 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 week 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 4 days ago

Yeah let's take a look.