Hono

H

Hono

This is the official Hono discord server for the community

Join

[zod, bun]#openapi async/await doesn't work

This ossue was previously on https://discord.com/channels/1011308539819597844/1012485912409690122/1242558525012709539, but I was advised to open it here. here is a noob question. Im quite new to TS, bun and Hono with Zod. I cant make sense of why TS is screaming at me in the first line with async ```ts apps.openapi(routeGetApp, async (c) => {...

where cookies??? where res?

Hi everyone, I'm not using cookies at all, or trying to mess with the headers myself and am getting this error in a POST handler: [NOTE]: i'm porting this from express to hono and the logic hasn't changed and this has been working forever (in express) [ALSO]: the user is created in the database, the email is sent and received... this is my code:...
No description

How to debug Hono/HonoX in Visual Studio Code?

I always run the code via npm run dev or bun dev. Since I am building a web app in HonoX and most of it is SSR, how can i use the IDE debugger so I can hit breakpoints and etc in Visual Studio Code? Ex: next.js has this guide: https://nextjs.org/docs/pages/building-your-application/configuring/debugging How do I do this for Hono/X?...

Does the context object get shared across all sessions?

I am using hono-sessions. I have several different users. Am I correct in assuming that each invocation in hono shares 1 context object ... so if I store something directly using context.set(x, y) it will be shared by every route?

middleware on a router level

Right now, i have this setup, where canExperiment is also a middleware: ```javascript export const statisticsRouter = new Hono(); statisticsRouter.get('/monitor', monitorHandler);...

Hono and 3rd party middleware on Deno

Hi, I use Hono and 3rd party middleware on Deno. I import them with npm / esm. Is there a better way to link dependencies with hono ? Does porting them on jsr will help ?...

Can't get webhook path to work

Whenever clerk fires a user_updated | user_created event I want to catch in on /webhook/clerk/user-updated path using hono routing. I get 404 everytime clerk fires that event. However, if I look at the typeof routes I see that I have /webhook/clerk/user-updated/$post I don't get it why the route is not accessible from the outside. This is my index.ts ```...

hono-sessions not sharing state between routes.

Hi was just working through hello world login/logout scenario but cannot seem to get the state shared between different routes created in separate files?

Hot reload not working? (BUN)

I try to setup the @hono/vite-dev-server with the default setup vite.config.ts ```ts import { defineConfig } from "vite";...

Node.js does not work in Next.js

My hono implementation works fine on edge in Next.js. But, I am getting the following error when migrating from edge (hono/vercel) to nodejs (@hono/node-server/vercel). ```ts ⨯ TypeError: outgoing.writeHead is not a function at responseViaResponseObject (webpack-internal:///(rsc)/./node_modules/@hono/node-server/dist/vercel.mjs:373:14)...

Is it possible to return only an image / file?

I know in Node.js you can use a function on the response called res.sendFile. I was curious if Hono has anything similar?

[solved] HtmlEscapedString not rendering?

When I have this function ``` import { HtmlEscapedString } from 'hono/utils/html' ...

validating arrays coming from forms

The following code works ``` <form action='?'...

[solved] return type of request handler

Why is 1) is fine and 2) has a type problem? 1) ```...

[solved] route param validation with zod

``` .delete('/foo/:id', zValidator('param', z.object({ id: z.number() })), async (c) => { const { id } = c.req.valid('param')...

Having middleware routes in RPC

Hi, I'm setting up honojs as the API of a SPA, with authjs as authentication library using the honojs middleware (https://github.com/honojs/middleware/tree/main/packages/auth-js) I have the auth and RPC setup in the following way ```JS app.use('/auth/*', authHandler());...

Importing AppType to client defaults output to any types

Hi, I just started using Hono yesterday and I'm loving it, but I'm facing an issue where, when I import AppType to the client, the types for output default to the Any type. I'm currently stumped on why this happens. Client src: /packages/frontend/src/lib/apis/images/index.ts ```typescript import type { AppType } from "@tavern/functions/src/stableDiffusion";...

How to use handlebars or pug in honojs?

Hi, i'm want to use view engine (like handlebars and pug ) in honojs. Is there any way to use it?

How to handle multiple errors in (react query) using (hono rpc)?

How can I handle multiple errors like in my case? I want to display the error on my signup form layout....

Type 'Hono<App {...}>' does not satisfy the constraint 'Hono<any, any, any> Property '#private' in t

Hi, I'm trying to use hono RPC client on my frontend project. But the type not working properly. I'm using "hono": "^4.3.7", on server and client. // On /web-api/src/routes/index.ts [Server] ```js import { App } from "@/@types/app";...