Skip to content

Fix server islands returning 404 in Netlify production with output: static#16063

Merged
matthewp merged 1 commit into
mainfrom
fix/netlify-buildoutput-before-setadapter
Mar 24, 2026
Merged

Fix server islands returning 404 in Netlify production with output: static#16063
matthewp merged 1 commit into
mainfrom
fix/netlify-buildoutput-before-setadapter

Conversation

@matthewp
Copy link
Copy Markdown
Contributor

Changes

  • Server Islands (server:defer) now work correctly in Netlify production deployments when using output: 'static' (the default). Previously the /_server-islands/* endpoint returned 404.
  • The bug was in astro:config:done: buildOutput was destructured from the hook params before setAdapter() was called, capturing a stale 'static' snapshot. Since buildOutput is a getter on settings.buildOutput, and setAdapter() upgrades it to 'server', the fix is to read params.buildOutput after setAdapter() rather than destructuring it upfront.

Testing

  • Added a regression test in test/static/static-headers.test.js that asserts the SSR function directory is created after building a output: 'static' project with a server:defer island — the exact scenario from the bug report.
  • The existing static-headers fixture already had this setup, so no new fixture was needed.

Docs

No docs update needed — this is a bug fix restoring already-documented behavior.

Closes #16049

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 24, 2026

🦋 Changeset detected

Latest commit: 0b4182f

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions Bot added the pkg: integration Related to any renderer integration (scope) label Mar 24, 2026
@matthewp matthewp marked this pull request as ready for review March 24, 2026 15:47
@matthewp matthewp merged commit ccb6a9c into main Mar 24, 2026
21 checks passed
@matthewp matthewp deleted the fix/netlify-buildoutput-before-setadapter branch March 24, 2026 16:42
@astrobot-houston astrobot-houston mentioned this pull request Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: integration Related to any renderer integration (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Problem after upgrading from Astro 5 to 6: Server Island (server:defer) returns 404 in production on Netlify, works fine in dev

2 participants