|
4 | 4 |
|
5 | 5 | Fix Vercel deployment API endpoints returning HTML instead of JSON. |
6 | 6 |
|
7 | | -Replace the custom `getRequestListener` export in `server/index.ts` with the |
8 | | -standard `handle()` adapter from `@hono/node-server/vercel` and the |
9 | | -outer→inner Hono delegation pattern (`inner.fetch(c.req.raw)`). |
| 7 | +The `bundle-api.mjs` script was emitting the serverless function to `api/index.js` |
| 8 | +at the project root, but `vercel.json` sets `outputDirectory: "dist"` — causing |
| 9 | +Vercel to never find the function entrypoint and fall back to the SPA HTML route |
| 10 | +for all `/api/*` requests. |
10 | 11 |
|
11 | | -- The `handle()` adapter correctly wraps the Hono app with the |
12 | | - `(IncomingMessage, ServerResponse) => Promise<void>` signature that |
13 | | - Vercel's Node.js runtime expects for serverless functions in `api/`. |
14 | | -- `@hono/node-server/vercel`'s `getRequestListener()` already handles |
15 | | - Vercel's pre-buffered `rawBody` natively, removing the need for the |
16 | | - custom body-extraction helper. |
17 | | -- The outer→inner delegation pattern matches the documented ObjectStack |
18 | | - Vercel deployment guide and the `@objectstack/hono` adapter test suite. |
| 12 | +- Change esbuild `outfile` from `api/index.js` to `dist/api/index.js` so the |
| 13 | + bundled serverless function lands inside the Vercel output directory. |
| 14 | +- Add explicit `functions` config in `vercel.json` pointing to `api/index.js` |
| 15 | + (relative to `outputDirectory`) with `@vercel/node@3` runtime. |
| 16 | +- Remove obsolete `.gitignore` entries for `api/index.js` and `api/index.js.map` |
| 17 | + (now emitted under `dist/` which is already git-ignored). |
0 commit comments