-
-
Notifications
You must be signed in to change notification settings - Fork 53
Default hono app doesn't work on vercel #247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
this demo app is deployed to vercel you can watch this tutorial on how to deploy hono |
Okay this is really useful thank you and the approach makes sense and feels way less hacky. I feel like I'm super close. But there's one new issue that the video doesn't talk about and the repo doesn't seem to have. The function is bundled up to be 5.4MB which seems right to me. But it's just triggering a download of the files contents of /api/index.ts rather than actually running the function. |
I have the same issue. |
@AmanVarshney01 import { handle } from "hono/vercel";
import app from "../src";
const handler = handle(app);
export const GET = handler;
export const POST = handler;
export const PATCH = handler;
export const PUT = handler;
export const OPTIONS = handler; and {
"rewrites": [
{
"source": "/api/(.*)",
"destination": "/api"
}
],
"redirects": [{ "source": "/", "destination": "/api", "permanent": false }]
} Like the example https://github.com/vercel/hono-starter/ But I got a runtime error
Even though the source did include it: ![]() I also checked the build code and verified that my |
@nirtamir2, would it be possible for you to share the repo? |
You can use: pnpm create better-t-stack@latest my-better-t-app --yes --frontend tanstack-router native-nativewind --runtime node --api orpc --database postgres --orm prisma --package-manager pnpm --no-git --no-install --examples todo I want to deploy the server here. |
Sorry, but deploying Hono on Vercel is kind of rough. I couldn't find a solution. :( |
For what it’s worth, my solution was using next.js as the backend with
better stack and then manually integrating hono as the catch all handler
by following this guide.
https://hono.dev/docs/getting-started/vercel
…On Fri, May 23, 2025 at 12:47 PM Aman Varshney ***@***.***> wrote:
*AmanVarshney01* left a comment (AmanVarshney01/create-better-t-stack#247)
<#247 (comment)>
Sorry, but deploying Hono on Vercel is kind of rough. I couldn't find a
solution. :(
—
Reply to this email directly, view it on GitHub
<#247 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AOELQYYKPEBSYTCF2JMBPVL275ULDAVCNFSM6AAAAAB43D4EUGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDSMBVGQ3TAMRTGM>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
But I want to use tanstack start. What do you use to deploy hono for free and without a credit card? |
Uh oh!
There was an error while loading. Please reload this page.
Spent several hours trying to configure the default hono projects to work on vercel and it's a real pain.
First error you get is: https://vercel.com/docs/errors/error-list#missing-public-directory
Then once you say that dist is the output folder or you add a public directory you're still stuck. I tried manually labeling the index.js in src/dist as a function with vercel.json. Using the VERCEL_HELPERS=0. I have gotten the files deployed and it treats them as static files not functions. Seems like you need to put things in /api folder for them to be functions, but then even once I get those invoked with the right path and redirecting the deployment to /api, I get import errors with path resolution. The default hono vercel template has edge runtime working and the vercel template has vercel functions working, but oRPC fails when module resolution isn't node and vercel throws module not found errors when the module resolution is "bundler".
Starting command
bun create better-t-stack@latest my-better-t-app --yes --api orpc --addons biome turborepo --examples ai todo
Docs I've read:
https://vercel.com/docs/functions/functions-api-reference
https://vercel.com/docs/project-configuration
https://vercel.com/docs/functions/runtimes/node-js
https://hono.dev/docs/getting-started/vercel
https://vercel.com/templates/hono/hono-on-vercel
Has anyone been able to figure it out?
The text was updated successfully, but these errors were encountered: