Environment
-
Framework: SvelteKit
-
Adapter:
@sveltejs/adapter-vercel -
i18n Library: Paraglide JS (
@inlang/paraglide-sveltekit) -
Locales:
en,ckb(path-based, e.g.,/en/isr,/ckb/isr) -
Hosting: Vercel
Problem
ISR (Incremental Static Regeneration) works for the base route /isr, but all localized routes (/en/isr, /ckb/isr) return 404 Not Found on Vercel. Everything works correctly in local development.
Repo
https://github.com/d1d4r/isr-sveltekit
https://isr-sveltekit.vercel.app/ckb/isr
What Works
-
/isr— works and caches correctly -
Local development — all localized routes work
What Doesn’t Work
-
/en/isr— returns 404 on Vercel -
/ckb/isr— returns 404 on Vercel
Root Cause Analysis
Vercel’s ISR operates at the edge layer, which runs before SvelteKit’s reroute hook processes the request. When a request comes in for /en/isr:
-
Vercel’s edge looks for a cached ISR page at
/en/isr -
No cache exists (ISR config only exists for
/isr) -
Returns 404 before SvelteKit’s
reroutecan map/en/isr→/isr
Solutions Attempted
| Attempt | Result |
|---|---|
Changed expiration: false to expiration: 60 |
Still 404 |
Added vercel.json rewrites for locale paths |
Routes work but locale detection breaks (always defaults to en) |
Using [lang] dynamic route segment |
Not compatible with Paraglide’s architecture |
Expected Behavior
Localized routes (/en/isr, /ckb/isr) should work with ISR, respecting SvelteKit’s reroute hook to map them to the underlying /isr route while maintaining correct locale context.
Question
How can ISR be configured to work with Paraglide JS’s middleware-based rerouting approach on Vercel? Is there a way to make Vercel’s edge layer aware of the rerouted paths, or a recommended pattern for this use case?