No valid entrypoint found. Valid entrypoints are - Hono

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!

2 Likes

thanks for the reply. this still doesn’t work.

my main export is a Hono app instance…

Example code here. lib/server.ts will be compiled as the main export file (rsshub-vercel/src/index.js at main · RSSNext/rsshub-vercel · GitHub).

Hmmm, in that case I have no idea tbh. I just basically went with the default turborepo + hono starter from the Vercel examples and that worked initially. It exports a new Hono() app at the end.

Then I changed that to the open api version and things started breaking at that point.

Thats why I went back to just exporting Hono as it is

1 Like

Do you have a src/index.js or src/index.ts file? The deployment should pick that up automatically

Following what @drgdfyi suggested works for but I’m kind of curious what change in your end as the deployment was working before but all of a sudden it stoped working on Friday

2 Likes

Yes, there is. The source code up above I quoted will be compiled into a index.js file under the directorysrc.

This is the compiled file: rsshub-vercel/src/index.js at main · RSSNext/rsshub-vercel · GitHub

the root cause is here. we cannot use dynamic export since last change. make it sync will be a valid entrypoint:

export { default } from './app-bootstrap';

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.