komal.nakrani
Browse Themes
ThemesCategoriesDocsBlogTips & Tricks
Server Rendering••By Komal Nakrani

Fix: Cannot Use Server-Side Rendering Without an Adapter

Astro's 'Cannot use server-side rendering without an adapter' means a page renders on demand but no adapter is set. Add one, or make the page static again.

#Astro#Errors#SSR#Adapters

Astro fails with “Cannot use server-side rendering without an adapter” when at least one page or endpoint renders on demand, through export const prerender = false or output: 'server', but astro.config.mjs has no adapter. An adapter is what turns on-demand routes into something your host can run. Install the one for your host with npx astro add, or remove the on-demand setting if the page can be static.

Key Takeaways

  • Any prerender = false page, or output: 'server', needs an adapter.
  • npx astro add node | cloudflare | netlify | vercel installs and configures one.
  • If you added prerender = false by accident, delete it and the error goes away.
  • Actions, sessions and server islands also need an adapter.

The full message

“Cannot use server-rendered pages without an adapter. Please install and configure the appropriate server adapter for your final deployment.”

Find what’s on demand

Search the project:

grep -rn "prerender = false" src/
grep -n "output" astro.config.mjs

Endpoints count too. A src/pages/api/contact.ts with export const prerender = false triggers the error just like a page.

Fix 1: add an adapter

Pick the one for where you deploy:

npx astro add node        # your own server, VPS or container
npx astro add cloudflare  # Cloudflare Workers / Pages
npx astro add netlify
npx astro add vercel

astro add installs the package and writes the config:

// astro.config.mjs
import { defineConfig } from 'astro/config';
import netlify from '@astrojs/netlify';

export default defineConfig({
  adapter: netlify(),
});

Your static pages stay static; only the on-demand routes run on the server. The Astro SSR guide compares adapters and their runtimes.

Fix 2: make the page static

If the page doesn’t need per-request data, remove the opt-out:

- export const prerender = false;

For dynamic routes, you’ll then need getStaticPaths(); see getStaticPaths() required.

Many features have static alternatives: a third-party form endpoint instead of an action, client-side fetch for small dynamic bits, or a rebuild on content change. The newsletter signup tip shows a static form approach.

For mixing static and dynamic pages, see mixing static and on-demand pages. The official notes are in the on-demand rendering guide.

FAQ

Do static Astro sites need an adapter?

No. A fully prerendered site builds to dist/ and deploys to any static host without one.

Does adding an adapter make my whole site server-rendered?

No. With the default output: 'static', only pages marked prerender = false render on demand. Everything else is still built to HTML.