fix: server islands broken in dev mode with adapters that don't set buildOutput#15703
Merged
fix: server islands broken in dev mode with adapters that don't set buildOutput#15703
Conversation
…5701) Server islands in dev mode with adapters that don't set adapterFeatures.buildOutput (like @astrojs/netlify) were broken because buildOutput was reset to 'static' after runHookConfigDone already set it to 'server' via setAdapter(). This moves the default assignment before runHookConfigDone, matching the build path ordering.
🦋 Changeset detectedLatest commit: 2aad653 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 |
ematipico
reviewed
Mar 2, 2026
|
|
||
| Fixes server islands returning a 500 error in dev mode for adapters that do not set `adapterFeatures.buildOutput` (e.g. `@astrojs/netlify`) | ||
|
|
||
| The `/_server-islands/[name]` endpoint was incorrectly requiring `getStaticPaths()` because `settings.buildOutput` was being reset to `'static'` after the adapter had already set it to `'server'`. |
Member
There was a problem hiding this comment.
This doesn't seem relevant to our users
Comment on lines
+397
to
+433
| describe('dev with adapter that does not set buildOutput', () => { | ||
| let devServer; | ||
| /** @type {import('./test-utils').Fixture} */ | ||
| let devFixture; | ||
|
|
||
| before(async () => { | ||
| // Use an adapter that does NOT set adapterFeatures.buildOutput, | ||
| // like @astrojs/netlify. This triggers the bug in container.ts where | ||
| // buildOutput is reset to 'static' after runHookConfigDone sets it to 'server'. | ||
| devFixture = await loadFixture({ | ||
| root: './fixtures/server-islands/hybrid', | ||
| adapter: testAdapter({ | ||
| extendAdapter: { | ||
| adapterFeatures: { | ||
| // Explicitly omit buildOutput to mimic Netlify adapter | ||
| }, | ||
| }, | ||
| }), | ||
| }); | ||
| devServer = await devFixture.startDevServer(); | ||
| }); | ||
|
|
||
| after(async () => { | ||
| await devServer?.stop(); | ||
| }); | ||
|
|
||
| it('can fetch the server island endpoint in dev mode', async () => { | ||
| const res = await devFixture.fetch('/'); | ||
| assert.equal(res.status, 200); | ||
| const html = await res.text(); | ||
| // Extract the server island fetch URL from the rendered page | ||
| const fetchMatch = html.match(/fetch\('(\/_server-islands\/Island[^']*)/); | ||
| assert.ok(fetchMatch, 'should have a server island fetch URL'); | ||
| const islandRes = await devFixture.fetch(fetchMatch[1]); | ||
| assert.equal(islandRes.status, 200, 'server island endpoint should return 200, not GetStaticPathsRequired error'); | ||
| }); | ||
| }); |
Member
There was a problem hiding this comment.
This test can be simplified:
- it doesn't need a describe
- it doesn't need before/after hooks
Everything can be done in a simple it because configuration and fixtures are scoped to a single test
florian-lefebvre
approved these changes
Mar 2, 2026
Co-authored-by: Florian Lefebvre <contact@florian-lefebvre.dev>
ematipico
approved these changes
Mar 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
adapterFeatures.buildOutput, including@astrojs/netlify.Testing
server-islands.test.jsthat checks if the server island endpoint can be called.Docs
N/A, bug fix.