[▲ Vercel Community](/) · [Categories](/categories) · [Latest](/latest) · [Top](/top) · [Live](/live) [Help](/c/help/9) # Hono API on Vercel crashes with ERR_MODULE_NOT_FOUND when importing server files 42 views · 3 likes · 4 posts Lancer751 (@lancer751) · 2026-03-10 Help vercel • hono • serverless **Summary** I deployed a full-stack application using **Hono** for the API and **Vite/React** for the frontend. The deployment succeeds, but I can only the serverless function crashes in the preview page. From the logs, it appears Vercel cannot resolve a module imported from outside the `/api` directory. --- **Project Setup** My project structure looks like this: ``` honno-react-demo │ ├ api │ └ index.ts │ ├ server │ ├ app.ts │ └ routes │ └ expenses.route.ts │ ├ frontend │ ├ src │ └ dist │ └ package.json ``` The API entry file is: `/api/index.ts` ```ts import app from "../server/app"; import { handle } from "hono/vercel"; export const GET = handle(app); export const POST = handle(app); export const PUT = handle(app); export const PATCH = handle(app); export const DELETE = handle(app); export const OPTIONS = handle(app); ``` My Hono app is defined in: `/server/app.ts` ```ts import { Hono } from "hono"; import { logger } from "hono/logger"; import { expensesRoute } from "./routes/expenses.route"; const app = new Hono(); app.use("*", logger()); const apiRoutes = app .basePath("/api") .route("/expenses", expensesRoute); export default app; export type ApiRoutes = typeof apiRoutes; ``` --- **Current Behavior** The deployment completes successfully and the frontend loads, but when I call the API endpoint: ``` /api/expenses/total-spent ``` the request returns: ``` 500: INTERNAL_SERVER_ERROR Code: FUNCTION_INVOCATION_FAILED ``` --- **Serverless Function Logs** ``` Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/var/task/server/app' imported from /var/task/api/index.js ``` So it seems the serverless function cannot resolve: ``` ../server/app ``` --- **What I’ve Tried** * Verified that the path is correct locally * Confirmed the app works locally using `vercel dev` * Removed any Bun-specific imports (`hono/bun`) * Checked that `hono` is listed in dependencies --- **Questions** 1. Does Vercel serverless only bundle files inside `/api` by default? 2. Should the Hono app be moved into the `/api` directory? 3. Is there a recommended structure for deploying a Hono API with Vercel? Any guidance would be greatly appreciated. Thank you! Here is the link to my repository: https://github.com/lancer751/hono-bun-react--demo system (@system) · 2026-03-10 · ♥ 1 If you're having trouble deploying an Express app, this guide can help. https://vercel.com/guides/using-express-with-vercel You can also ask [v0](https://v0.dev/) for suggestions tailored to your own project setup. Jayarbrul (@jayarbrul01-8727) · 2026-03-11 · ♥ 1 It looks like the issue is related to how Vercel bundles and deploys serverless functions, and it seems the app in the `/server` directory isn’t getting bundled correctly as part of the function in `/api`. Pauline P. Narvas (@pawlean) · 2026-03-11 · ♥ 1 The module resolution system requires explicit file extensions in imports. Could you try adding file extensions to the imports? Like: ``` import { something } from './server/file.js' ```