From a8f0923b28a4d37d0185dbbc8ebbbc75296eb36c Mon Sep 17 00:00:00 2001 From: Alaister Young <10985857+alaister@users.noreply.github.com> Date: Wed, 22 Apr 2026 01:19:14 +0800 Subject: [PATCH] chore(studio): route /api/* and /_serverFn/* to Vercel function in vercel.ts --- apps/studio/vercel.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/apps/studio/vercel.ts b/apps/studio/vercel.ts index 932ed997b89..67731e62b5c 100644 --- a/apps/studio/vercel.ts +++ b/apps/studio/vercel.ts @@ -11,6 +11,14 @@ export default { framework: null, outputDirectory: 'dist/client', rewrites: [ + // API + server-function passthrough. Both funnel through the single + // `/api/server` Vercel Function that TanStack Start generates. These + // must come before the asset rule so that extensioned API paths like + // `/api/foo.json` still hit the function instead of a filesystem lookup. + // The destination is un-prefixed because the function is registered at + // `/api/server` regardless of the app's base path. + { source: `${basePath}/api/(.*)`, destination: '/api/server' }, + { source: `${basePath}/_serverFn/(.*)`, destination: '/api/server' }, // Asset passthrough. Matches anything ending in `.ext` (e.g. // `/foo/assets/bundle.abc.js`) and rewrites to the un-prefixed path so // Vercel finds it in `dist/client/`. If the file doesn't exist Vercel