Skip to content

Astro: carry astro-sst as @sst-community/astro-sst, for Astro 5, 6 and 7 #44

Closed

Description

@AlperSakarya

What

Carry the astro-sst adapter into this repo as packages/astro-sst, published as @sst-community/astro-sst and installed under the old name, the same way as svelte-kit-sst:

npm install astro-sst@npm:@sst-community/astro-sst

Imports stay import aws from "astro-sst", and existing instructions keep working. One package for Astro 5, 6 and 7.

Why

sst.aws.Astro needs the astro-sst adapter, and its latest release (3.1.4, May 2025) is stuck on Astro 5:

  • It doesn't build on Astro 7: "applyPolyfills" is not exported by astro/app/node.
  • On Astro 6 and 7 it warns that entrypointResolution: "explicit" is deprecated.
  • Astro 7's advanced routing (src/fetch.ts) is ignored. astro-sst builds its app with new NodeApp(manifest), and Astro only installs src/fetch.ts when the app comes from createApp() in astro/app/entrypoint.
  • A route that only fetch.ts handles gets a 404 even then, because the handler calls app.match() first and returns its own 404 when no Astro route matches, before app.render() runs.

Tested locally on Astro 7.3.5 with astro-sst 3.1.4, running the built handler with a fake API Gateway event. A patched copy (no applyPolyfills, entrypointResolution: "auto", createApp(), app.render() without the pre-check) served fetch.ts's header on /, served a fetch.ts-only route with 200, and still returned 404 for an unknown path. sst.aws.Astro read the Astro 7 build output fine. Not deployed, and only the buffered handler was tried.

Users impacted

Anyone on Astro 6 or 7 who deploys with SST, and anyone who wants Astro 7's advanced routing. What's open today:

  • how to deploy astro v6? anomalyco/sst#6697 "how to deploy astro v6?" Open since 2026-04-07, 8 comments. SST said it would probably upgrade the adapter, then that it hoped to land an official AWS Astro provider, then (June) that it might do the upgrade itself. On 2026-06-23 a user wrote that Astro 7 is out and they're blocked.
  • feat: support astro 6 anomalyco/astro-sst#27 "feat: support astro 6". Open since 2026-03-10, last updated 2026-09-21. By an Astro core maintainer. Moves to createApp() and entrypointResolution: "auto", with separate buffer and stream entrypoints, for Astro 6+ only (drops Astro 5). Six comments from users asking for it to be merged, one saying it blocks their work and one asking for Astro 7 support (the PR's author replied that the next major should cover 6 and 7). One commenter also points to a libheif security advisory (GHSA-g89c-p67h-r497) as a reason to leave Astro 5; I haven't checked it. It keeps the app.match() pre-check, so a fetch.ts-only route would still 404.
  • how to deploy astro v6? anomalyco/astro-sst#28 "how to deploy astro v6?" Open since 2026-04-07; points at Bus: stop a stuck subscriber from freezing sst dev #27.
  • Astro 5.7 Sessions API anomalyco/astro-sst#20 "Astro 5.7 Sessions API", open since 2025-04. Not part of this; noted for later.
  • A question in the community Discord asking how to make Astro 7's advanced routing work with astro-sst.

There is no open issue or PR about advanced routing itself.

In this repo, the examples aws-astro, aws-astro-stream, aws-astro-container and aws-astro-redis pin astro-sst 2.x (^2.41.2 or 2.43.5), older than the 3.1.2 that sst.aws.Astro already requires.

Plan

Mirrors packages/svelte-kit-sst (#6):

  1. packages/astro-sst: the adapter from anomalyco/astro-sst (MIT), with PR Bus: stop a stuck subscriber from freezing sst dev #27's changes as the base and its author credited as co-author.
    • Astro 6 and 7: entrypointResolution: "auto", createApp(), separate buffer and stream entrypoints.
    • Astro 5: keep the current NodeApp path, chosen by feature detection like the SvelteKit adapter does (no createApp in Astro 5). No applyPolyfills.
    • Render through app.render() without a match-first 404, keeping the 404.html and /404 fallbacks, so src/fetch.ts works.
  2. Tests, like svelte-kit-sst's: build Astro 5, 6 and 7 apps with the adapter, bundle the handler as SST does, call it with Lambda events (buffer and stream). Cases: pages, 404, cookies (multiple set-cookie), POST body, binary, redirects, prerendered pages, src/fetch.ts on Astro 7.
  3. CI: .github/workflows/astro-sst.yml, like svelte-kit-sst.yml.
  4. README and CHANGELOG with the alias install; build on prepack; publishConfig.access: public.
  5. Wiring in the rest of the repo:
    • pkg/global/distribution.go: add astro-sst to CommunityPackages, so sst init installs it under the old name.
    • platform/templates/astro/preset.json, www/.../start/aws/astro.mdx, README: the install command and the Astro 6/7 notes.
    • platform/src/components/aws/astro.ts: the version check and error text (it requires astro-sst 3.1.2 or later; the new package's version must pass it).
    • Examples: move the four above to the alias.

Still to decide

  • The version number for the first release. svelte-kit-sst started at 3.0.0.
  • Whether to keep supporting Astro 5 (the plan above does, since sst.aws.Astro users may still be on it).

Activity

  1. the-human-mustachio commented on Oct 7, 2026

    @the-human-mustachio
    Contributor

    Here's the plan. We'll build it on the astro-sst branch and open a PR from it. Comments on the approach are welcome before then.

    The package

    @sst-community/astro-sst 4.0.0 lives in packages/astro-sst and is released the same way as @sst-community/svelte-kit-sst. One version supports Astro 5, 6 and 7.

    The adapter

    • Astro 6 and 7. We start from feat: support astro 6 anomalyco/astro-sst#27 by florian-lefebvre, credited in the commit and the changelog. It builds the app with createApp from astro/app/entrypoint and entrypointResolution: "auto", for both the buffered and the streaming handler.
    • Astro 5. Today's 3.1.4 code stays as a separate path, applyPolyfills included. Astro 5 has no astro/app/entrypoint, and Bus: stop a stuck subscriber from freezing sst dev #27 drops Astro 5 on purpose. The adapter picks the path when the app is built, from the installed astro/package.json. The current adapter also breaks on recent Astro 6: 6.4.8 and 7 no longer export applyPolyfills.
    • 404s. The app.match() check before rendering goes. The adapter calls app.render() and passes prerenderedErrorPageFetch, which returns the bundled 404.html. That way Astro decides when a 404 applies, and routes that only src/fetch.ts handles work. Astro 5, 6 and 7 all have the option.
    • The entrypoint. serverEntrypoint becomes a URL to the adapter's file instead of the package name. That works whether the app installs the package under the alias astro-sst (what sst init writes) or as @sst-community/astro-sst.

    What sst.aws.Astro reads, which stays the same

    • dist/server/entry.mjs exports handler.
    • 404.html stays in the server output folder, because the component copies it into the function.
    • sst.buildMeta.json keeps its fields. The component requires pluginVersion 3.1.2 or higher, which is why this is 4.0.0. Upstream's next release from Bus: stop a stuck subscriber from freezing sst dev #27 would also be 4.0.0, so our changelog will say ours supports Astro 5 to 7.

    Astro 6 and 7 need Node 22.12 or newer. Sites default to nodejs24.x, so this only affects a site that sets an older runtime. The docs will say so.

    Wiring

    • The adapter step in release.yml loops over every package in packages/, and publishes any version that isn't on npm yet.
    • CommunityPackages maps astro-sst to @sst-community/astro-sst, so sst init installs ours.
    • The Astro template and the docs use the fork's adapter.
    • The package keeps upstream's MIT licence and notice.

    Testing and release

    • The adapter's tests run against Astro 5, 6 and 7.
    • We deploy an Astro 7 site, buffered and streaming, and an Astro 5 site, with sst.aws.Astro.
    • 4.0.0 is published by hand before the CLI release that maps the name. Otherwise sst init fails for every Astro app. After that, release.yml publishes new versions through npm trusted publishing.
    • This doesn't hold up the next minor release. If it isn't ready, the release goes out without the wiring.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions