Hybrid rendering migration: adapter deployment hooks lack atomic switchover for static-to-server route transitions
0 reputation · 12 Nov 2023, 20:55 UTC
0 reputation · 12 Nov 2023, 20:55 UTC
Astro 2.0 introduced hybrid rendering via output: 'hybrid' and per-route export const prerender = false, enabling incremental migration of routes from static to server-rendered without a full-site rebuild. The goal is to flip individual routes to server rendering while keeping the rest of the site static, ideally with zero downtime.
Adapter deployment hooks (Node, Vercel, Netlify, Cloudflare) do not guarantee atomic replacement of static assets and server functions during redeployment. When a route's prerender value changes, the build produces new server entry points and updated static HTML, but the platform may serve stale static files while new server functions cold-start, or vice versa. Middleware executes before route matching in hybrid mode, so authentication or redirect logic can behave inconsistently during the transition window. Content Collections and Content Layer further complicate this by requiring a full rebuild on schema changes, negating incremental migration for content-driven routes.
A thoughtful contribution can make all the difference. Be the first to share one.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.