Commit Graph
5 Commits
Author SHA1 Message Date
Alaister Young 40ef24a095 fix(studio): export TanStack handler directly using Vercel Web API convention
TanStack's server bundle already exposes `.fetch(request)`. Vercel's
Web API handler pattern (per the docs) invokes that method on the
default export, passing a real Web Request — so we can skip the
hand-rolled IncomingMessage→Request adapter entirely.
2026-04-22 02:15:30 +08:00
Alaister Young 13958a1997 fix(studio): normalize Vercel Node request shape in API wrapper
Vercel's Node runtime hands the function an IncomingMessage-shaped object:
path-only `.url`, plain-object `.headers`, Node Readable `.body`. TanStack's
H3 server wants a Web-standard Request. Convert headers to a Headers
instance, rebuild an absolute URL from the host header, and bridge the
Node stream body to a web ReadableStream via Readable.toWeb.
2026-04-22 02:13:57 +08:00
Alaister Young d5ebdebc40 fix(studio): normalize request URL before handing off to TanStack handler
Vercel's Node runtime passes a Request-like object where `.url` is
path-only (IncomingMessage semantics). TanStack's H3Event constructor
calls new URL(req.url) and crashes with ERR_INVALID_URL. Reconstruct
the URL from the host header before forwarding.
2026-04-22 02:09:51 +08:00
Alaister Young 9ee354ee65 feat(studio): serve SPA shell on unprefixed paths too
Keep the base-path-prefixed rewrites for assets and routes that Vite
already baked the prefix into, but also emit root-level rewrites so
bare-domain hits (including /) resolve to the shell instead of Vercel's
default 404.
2026-04-22 01:58:52 +08:00
Alaister Young c4cc0e0772 fix(studio): revert vercel.ts back to default export, use routes helper
The @vercel/config 0.2.1 CLI spreads named exports as top-level keys
(except a small allowlist). `export const config` ends up nested as
`{"config": {"rewrites": [...]}}` in the compiled JSON — Vercel can't
find the rewrites at the top level. Default export matches what the
implementation actually expects despite the docs example suggesting
otherwise. Also swapped plain rewrite objects for the routes.rewrite
helper for type-safety on future additions.
2026-04-22 01:31:14 +08:00