Hono

H

Hono

This is the official Hono discord server for the community

Join

@hono/zod-openapi Middleware Issue

Hi there, I need some help in implementing middleware while using hono and @hono/zod-openapi. What I want to implement is running middleware after zod validation of query params but before the actual route handler. My code is as follows:...

Hono and Better-Auth

Hi there, I know this is the better-auth thing, but just asking for a help. This is my auth from api:...

Can not get vercel dev working on localhost with pnpm v10+

I'm using vercel cli v42.1.1 on a windows 11 OS. // package.json ```{ "name": "hono-open-api-starter", "type": "module",...
No description

RPC can't get types

```ts import { hc } from 'hono/client'; import type { AppType } from './index.js'; const c = hc<AppType>('http://localhost:3000');...
No description

RPC frontend import

Did anyone else also have the problem of building the frontend app when importing the RPC Types from the backend? How did you solve it? I don't know what to do anymore... I always get errors on non-existing imports in the frontend - this is pretty easy to understand because they are imports from the backend app. How can I solve it?...

serveStatic() doesn't serve files

I have a simple hono server with a trpc router. Unfortunately the bundled frontend isn't being served by the hono server. And API calls to the /trpc route are intercepted by the app.get('*', serveStatic({ root: '../../front/dist/index.html'})) route and also return a "404 not found". Here is the full code ```ts import { Hono } from 'hono' import { trpcServer } from '@hono/trpc-server'...

Streaming not working with Hono Node Server #4154

Streaming doesn't work. it send the response once it's done processing fully. i tried with the bun dev (not bun server) but somehow it seemed working, really strange. We can run this repo locally: https://github.com/nilooy/my-better-t-app-2 to reproduce it. the suspected code is here: https://github.com/nilooy/my-better-t-app-2/blob/main/apps/server/src/index.ts#L42-L60 ...

RPC

in the docs of the RPC there isn't mentioned anything about redirect. does this mean that using c.redirect('/my-path') work normally without any extra setup to the hono-client?...

Getting cors issues even though i've set it up properly

So i have a frontend client using nextjs and a my api using hono with cloudflare. for some reason my frontend client returns a cors issues but the api proceeds with the requests and returns a 200 repsonse. my cors setup: ```ts app.use("*", (c, next) => {...
No description

import.meta.hot is undefined when using hono with bun.

I am trying to add a function to the dispose callback as documented here: https://bun.sh/docs/bundler/hmr?utm_source=chatgpt.com#import-meta-hot-api-reference but when I log import.meta there isn't even a hot property in there....

Route types for client

I found an example that gives the hc client route types ```const app = new Hono(); const routes = app.get("/api/clock", (c) => { return c.json({ time: new Date().toLocaleTimeString(),...

Trying to send email with Resend and using react, but i got this error

Hi, i want try to sending email with resend and using react as a template but when i hit the endpoint to send that email i got this error. I'm using bun as a runtime
No description

websocket examples for node.js?

I am building a boilerplate using hono.js on the backend and web compoennts (vanilla js) on the client. I'm trying to figure out how to support websockets, but there's not much to go on from the official documentation for node.js

How to wait for streamSse to finish?

I am using hono's streamSSE helper to stream responses, which works great. However it seems that the streamSSE returns right away, and I have no way to await when the streaming is done. I have a middleware that collects metrics such as http request timings, and the middleware also returns immediately from await next() instead of waiting the streaming to be done, so the timings are completely wrong. Is there any way, in the middleware, to wait for the streaming to be done?...

Why isn't my dynamically extended Zod schema enforcing types in @hono/zod-openapi?

Hey folks, I'm running into something weird with @hono/zod-openapi I'm dynamically building a schema like this: ``` export const createChannelSchema = ({ withVideos = false }) => {...

Recommended way to register routes across files

What's the recommended way to register routes across files? I like to have 1 handler per file, and right now I do this: ```js export function registerExampleRoute(app: Hono) { app.get("/example", async (c) => {...

@hono/zod-openapi generates :param instead of {param} — breaks openapi-fetch compatibility

I'm using @hono/zod-openapi to generate an OpenAPI spec for my Hono backend, but it outputs paths like /channels/:handle instead of the OpenAPI standard /channels/{handle}. This breaks compatibility with openapi-fetch, which expects {param} syntax. Is there a way to configure @hono/zod-openapi to output {param} format instead of :param? Or is post-processing the generated OpenAPI JSON the only option? Appreciate any suggestions 🙏...

The inferred type of 'client' cannot be named without a reference to

Hono bros I need your help with a problem I can't figure out. My setup is a monorepo with this stucture. I have done this way to avoid leakage of server code into my frontend code. root...

Maintaining slugs when grouping

If I group my API into two apps, and then mount one of the groups into a path that contains a slug, how can I use that slug in the app? For example, here, how would I use thisSlugHere in booksApp? ```ts...

[SOLVED] CORS with origin of "localhost" doesn't work

Code used: ```app.use('*', cors({ origin: "localhost", credentials: true...