sst / ion

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

Using "warm" with sst.aws.Astro breaks lambda handler #485

Open cskeppstedt opened 4 months ago

cskeppstedt commented 4 months ago

Hello! I have an sst ion stack that contains an Astro site, and I tried to enable "warm" for the site:

const astro = new sst.aws.Astro("AstroSite", {
  domain: astroDomain,
  path: "packages/astro-site",
  warm: 1
});

Without the "warm" property, the site deploys fine and is reachable through the astroDomain.

But when I change to warm: 1, I get this error when trying to hit the same url:

Screenshot 2024-05-28 at 14 09 45

This results in a 502 Bad Gateway response from cloudfront that's in front of the astro function.

It also seems that the Runtime configuration of the lambda changes if I inspect in in the AWS console ui, Handler changes from packages/astro-site/dist/server/entry.handler to packages/astro-site/dist/server/server-index.handler.

My astro.config.mjs:

import { defineConfig } from "astro/config";
import tailwind from "@astrojs/tailwind";
import aws from "astro-sst";
import preact from "@astrojs/preact";

// https://astro.build/config
export default defineConfig({
  output: "server",
  adapter: aws(),
  integrations: [tailwind({ applyBaseStyles: false }), preact()]
});

Dependencies:

mhodgson commented 4 months ago

I believe this will be fixed one #469 is merged.