Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/actions-static-with-adapter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Fixes Actions failing with `ActionsWithoutServerOutputError` when using `output: 'static'` with an adapter
2 changes: 1 addition & 1 deletion packages/astro/src/actions/integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default function astroIntegrationActionsRouteHandler({
});
},
'astro:routes:resolved': ({ routes }) => {
if (!hasNonPrerenderedRoute(routes)) {
if (!settings.config.adapter && !hasNonPrerenderedRoute(routes)) {
const error = new AstroError(ActionsWithoutServerOutputError);
error.stack = undefined;
throw error;
Expand Down
19 changes: 19 additions & 0 deletions packages/astro/test/actions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,25 @@ describe('Astro Actions in static mode with prerender = false routes', () => {
});
});

it('Works with adapter and all pages prerendered', async () => {
const fixture = await loadFixture({
root: './fixtures/actions/',
output: 'static',
adapter: testAdapter(),
});
const devServer = await fixture.startDevServer();
const res = await fixture.fetch('/_actions/subscribe', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ channel: 'bholmesdev' }),
});

assert.equal(res.ok, true);
await devServer.stop();
});

it('Base path should be used', async () => {
const fixture = await loadFixture({
root: './fixtures/actions/',
Expand Down
Loading