sst / ion

SST v3
https://sst.dev
MIT License
1.88k stars 221 forks source link

aws.StaticSite errorPage issue #481

Closed iOSonntag closed 2 months ago

iOSonntag commented 4 months ago

Version: 0.0.393

Currently it is not possible to use the errorPage field in the StaticSite construct.

const website = new sst.aws.StaticSite('Website', {
      path: 'website',
      indexPage: 'index.html',
      // wont work 
      // errorPage: 'index.html',
      // errorPage: '/index.html',
      domain: {
        name: 'example.com',
        redirects: [
          'www.example.com',
        ],
      },
      transform: {
        cdn: {
          customErrorResponses: [
            // works
            {
              errorCode: 404,
              responsePagePath: '/index.html',
              responseCode: 200,
            },
          ],
        }
      }
});

The deploy fails with message: CloudFront: UpdateDistribution, https response error StatusCode: 400, RequestID: XXX, IllegalUpdate: Your request must specify both ResponsePagePath and ResponseCode together or both should be empty.

mlafeldt commented 2 months ago

I just ran into this bug. Here's a quick PR to fix it: #635