H
Hono2w ago
TARS

Vercel errors and noob questions

I am trying to deploy my simple hono app to vercel. I picked the vercel template when I ran the installer. I use better auth and this is the only thing I got in my index.ts right now:
import { Hono } from "hono";

const app = new Hono({ strict: false });

app.all("/api/auth/*", async (c) => {
const { auth } = await import("./lib/auth/index.js");
return auth.handler(c.req.raw);
});

app.get("/", (c) => c.text("Hello Hono!"));

export default app;
import { Hono } from "hono";

const app = new Hono({ strict: false });

app.all("/api/auth/*", async (c) => {
const { auth } = await import("./lib/auth/index.js");
return auth.handler(c.req.raw);
});

app.get("/", (c) => c.text("Hello Hono!"));

export default app;
First let me say everything is working as expected when I run it locally, the problems is when I deploy the app to vercel. With some help of chatgpt I finally got the "/" working, after I made changes to the tsconfig, as well as 1. Changed all imports to absolute 2. Added tje .js extension to all file inports (even though I use ts). I have not got the /api/auth/reference working yet (better auth openApi plugin), I get internal server error from vercel. To my questions. Will it always be like this? Having to import full filenames with .js even though I run .ts, having to do absolute imports "/dir/filename.js". In short, is this normal behaivour when you host a hono app on vercel (and other places)? Or are there issues unnormal and reflect that there might be some bigger issues with my app? If yes, are there any other cloud hosts that work better with deploying hono apps and get them working without having to be a 1337 haxxor? Thanks!
5 Replies
ambergristle
ambergristle2w ago
ChatGPT’s solution is pretty smelly. You definitely shouldn’t need to do that to run an app Better Auth is kind of a mess, tbh, but there should be some examples if you search through this discord Vercel is also kind of an (expensive) mess. The easiest (and cheapest) option for deployment is probably Cloudflare But platforms like Koyeb, Fly, and DigitalOcean also have click-to-deploy options Tl;dr - hard to say what the underlying issue is from the code you shared, but Vercel is not the place to deploy regardless
TARS
TARSOP2w ago
Thanks, I've been thinking abotu cloudflare workers, maybe I have a better luck there?
ambergristle
ambergristle2w ago
Maybe. I’ve found it to be a more reliable platform Really depends on what the underlying issue was though Regardless, ChatGPT is not a good tool to use. If you have issues, I’d recommend StackOverflow or this community
TARS
TARSOP2w ago
Yeah absolutely learned the the hard ways spending hours yesterday trying to get the whole thing working. Now I'm doing hono with the bun template, and bun runtime, in a docker container. Will i be able to host this somewhere?
ambergristle
ambergristle2w ago
Id recommend Koyeb for bun + docker

Did you find this page helpful?