I have a gatsby site that uses `StaticSite` and fo...
# help
d
I have a gatsby site that uses
StaticSite
and follows the Gatsby instructions pretty closely. I have a problem I don’t know how to solve so I’ll add everything that “seems” relevant. When I look at s3 I can see two folders, which is unexpected. One folder is from the 26th and the other from the 30th (thats “correct”). Nonetheless when I navigate to
<http://dev.comicshelper.com|dev.comicshelper.com>
it works, and you can click, blog, and it works great 🎉 However, if you navigate to
<http://dev.comicshelper.com/blog|dev.comicshelper.com/blog>
directly, you get a 403. I do see the file
/blog/index.html
in s3. Also, if I navigate to
<http://dev.comicshelper.com/blog/index.html|dev.comicshelper.com/blog/index.html>
it finds the file and everything works great. Did I maybe misconfigure something in s3 or in route53? This doesn’t seem like a gatsby issue, but maybe I’m wrong or missing something goofy.
j
Are you still having this issue @Devin?
d
Pretty much. I’m still trying to get the hosting to get activated
I’m currently trying to deploy
Copy code
const staticSite = new sst.StaticSite(this, "Site", {
      path: "website",
      indexPage: "public/index.html",
      errorPage: "404.html",
      buildOutput: "public",
      buildCommand: "npm run build",
      customDomain: getCustomDomain(scope.stage, {
        api: false,
        app: false,
        marketing: true,
      }),
      environment: {
        GATSBY_API_URL: api.url,
      },
      s3Bucket: {
        publicReadAccess: true,
      },
      cfDistribution: {
        defaultBehavior: {
          allowedMethods: AllowedMethods.ALLOW_ALL,
        },
      },
    });

    // in the stack:
    new BucketDeployment(this, "Website Deployment", {
      // Here goes the path to your website files.
      // The path is relative to the root folder of your CDK app.
      sources: [Source.asset("./website/public")],
      destinationBucket: staticSite.s3Bucket,
      autoDeleteObjects: true,
    });

    // Show the endpoint in the output
    this.addOutputs({
      // Show the url in the output
      StaticSiteUrl: staticSite.url,
    });
  }
*it didn’t work 😭 😂
j
Oh boy, I see some of your other posts around this as well. Do you know if folks have gotten this to work on S3+CF?
d
It seems like it. But I’m not sure. I don’t think this is a SST problem as much as an assumption that a static site would in a certain way at it doesn’t
This module appears to be the solution but I haven’t made this work either https://docs.aws.amazon.com/cdk/api/v2//docs/aws-cdk-lib.aws_s3_deployment-readme.html
j
Hmm I see