While trying to deploy Hono, I was getting this error, and this started about 5 hours ago. Take note that this is an existing project on Vercel, and I have deployed today multiple time before I started getting this error. I thought it may be because of a code change; I switched back to the main branch, which is the same code in production, but I got the same error both in the Vercel platform and CLI.
3 Likes
same issue, bro. Deployed successfully the last day, but today it shows this error with the same code.
1 Like
same issue here. it’s hono app. no code changes pushed.
there is src/index.js file existing in the repo.
also happening to me this is insane this isn’t fixed yet - express app
1 Like
Same my with my Hono project on Vercel
1 Like
Please any help here
1 Like
it still doesn’t work.
Hey all, this is happening because your main export is not a new Hono()
app/api.
At the moment, the only way you can deploy to Vercel is if your main export is Hono
.. not OpenAPIHono
or anything else they’ve got.
You can still use them though but you’ll need to do something like this (simplified example):
// THIS NEEDS TO BE EXPORTED AT THE END
const app = new Hono();
// OpenAPI sub-app or whatever else you want
const api = new OpenAPIHono();
api.doc("/openapi", {
openapi: "3.0.0",
info: {
title: "Name API",
version: "1.0.0",
},
});
api.get(
"/",
Scalar({ url: "/openapi", pageTitle: "Name API", theme: "saturn" })
);
// Register typed routes on the OpenAPI router
registerHealthRoutes(api);
registerExampleRoutes(api);
// Mount OpenAPI router at root - THIS IS IMPORTANT SO YOU CAN HAVE BOTH
app.route("/", api);
// EXPORT THE MAIN HONO APP
export default app;
Hope this helps!
1 Like